Enable ConstructorInitializerAllOnOneLineOrOnePerLine for better diff

This commit is contained in:
Tatsuhiro Tsujikawa 2016-01-27 21:14:07 +09:00
parent c5f3eee3be
commit 85bb37ab7c
30 changed files with 318 additions and 104 deletions

View File

@ -17,7 +17,7 @@ BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false BreakConstructorInitializersBeforeComma: false
BinPackParameters: true BinPackParameters: true
ColumnLimit: 80 ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerAlignment: false DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: false IndentCaseLabels: false

View File

@ -101,12 +101,24 @@ template <typename Array> void append_nv(Stream *stream, const Array &nva) {
} // namespace } // namespace
Config::Config() Config::Config()
: mime_types_file("/etc/mime.types"), stream_read_timeout(1_min), : mime_types_file("/etc/mime.types"),
stream_write_timeout(1_min), data_ptr(nullptr), padding(0), num_worker(1), stream_read_timeout(1_min),
max_concurrent_streams(100), header_table_size(-1), port(0), stream_write_timeout(1_min),
verbose(false), daemon(false), verify_client(false), no_tls(false), data_ptr(nullptr),
error_gzip(false), early_response(false), hexdump(false), padding(0),
echo_upload(false), no_content_length(false) {} num_worker(1),
max_concurrent_streams(100),
header_table_size(-1),
port(0),
verbose(false),
daemon(false),
verify_client(false),
no_tls(false),
error_gzip(false),
early_response(false),
hexdump(false),
echo_upload(false),
no_content_length(false) {}
Config::~Config() {} Config::~Config() {}
@ -225,8 +237,13 @@ class Sessions {
public: public:
Sessions(HttpServer *sv, struct ev_loop *loop, const Config *config, Sessions(HttpServer *sv, struct ev_loop *loop, const Config *config,
SSL_CTX *ssl_ctx) SSL_CTX *ssl_ctx)
: sv_(sv), loop_(loop), config_(config), ssl_ctx_(ssl_ctx), : sv_(sv),
callbacks_(nullptr), next_session_id_(1), tstamp_cached_(ev_now(loop)), loop_(loop),
config_(config),
ssl_ctx_(ssl_ctx),
callbacks_(nullptr),
next_session_id_(1),
tstamp_cached_(ev_now(loop)),
cached_date_(util::http_date(tstamp_cached_)) { cached_date_(util::http_date(tstamp_cached_)) {
nghttp2_session_callbacks_new(&callbacks_); nghttp2_session_callbacks_new(&callbacks_);
@ -424,8 +441,12 @@ void release_fd_cb(struct ev_loop *loop, ev_timer *w, int revents) {
} // namespace } // namespace
Stream::Stream(Http2Handler *handler, int32_t stream_id) Stream::Stream(Http2Handler *handler, int32_t stream_id)
: handler(handler), file_ent(nullptr), body_length(0), body_offset(0), : handler(handler),
stream_id(stream_id), echo_upload(false) { file_ent(nullptr),
body_length(0),
body_offset(0),
stream_id(stream_id),
echo_upload(false) {
auto config = handler->get_config(); auto config = handler->get_config();
ev_timer_init(&rtimer, stream_timeout_cb, 0., config->stream_read_timeout); ev_timer_init(&rtimer, stream_timeout_cb, 0., config->stream_read_timeout);
ev_timer_init(&wtimer, stream_timeout_cb, 0., config->stream_write_timeout); ev_timer_init(&wtimer, stream_timeout_cb, 0., config->stream_write_timeout);
@ -496,8 +517,13 @@ void writecb(struct ev_loop *loop, ev_io *w, int revents) {
Http2Handler::Http2Handler(Sessions *sessions, int fd, SSL *ssl, Http2Handler::Http2Handler(Sessions *sessions, int fd, SSL *ssl,
int64_t session_id) int64_t session_id)
: session_id_(session_id), session_(nullptr), sessions_(sessions), : session_id_(session_id),
ssl_(ssl), data_pending_(nullptr), data_pendinglen_(0), fd_(fd) { session_(nullptr),
sessions_(sessions),
ssl_(ssl),
data_pending_(nullptr),
data_pendinglen_(0),
fd_(fd) {
ev_timer_init(&settings_timerev_, settings_timeout_cb, 10., 0.); ev_timer_init(&settings_timerev_, settings_timeout_cb, 10., 0.);
ev_io_init(&wev_, writecb, fd, EV_WRITE); ev_io_init(&wev_, writecb, fd, EV_WRITE);
ev_io_init(&rev_, readcb, fd, EV_READ); ev_io_init(&rev_, readcb, fd, EV_READ);

View File

@ -87,9 +87,16 @@ struct FileEntry {
FileEntry(std::string path, int64_t length, int64_t mtime, int fd, FileEntry(std::string path, int64_t length, int64_t mtime, int fd,
const std::string *content_type, ev_tstamp last_valid, const std::string *content_type, ev_tstamp last_valid,
bool stale = false) bool stale = false)
: path(std::move(path)), length(length), mtime(mtime), : path(std::move(path)),
last_valid(last_valid), content_type(content_type), dlnext(nullptr), length(length),
dlprev(nullptr), fd(fd), usecount(1), stale(stale) {} mtime(mtime),
last_valid(last_valid),
content_type(content_type),
dlnext(nullptr),
dlprev(nullptr),
fd(fd),
usecount(1),
stale(stale) {}
std::string path; std::string path;
std::multimap<std::string, std::unique_ptr<FileEntry>>::iterator it; std::multimap<std::string, std::unique_ptr<FileEntry>>::iterator it;
int64_t length; int64_t length;

View File

@ -39,11 +39,18 @@ namespace asio_http2 {
namespace client { namespace client {
session_impl::session_impl(boost::asio::io_service &io_service) session_impl::session_impl(boost::asio::io_service &io_service)
: wblen_(0), io_service_(io_service), resolver_(io_service), : wblen_(0),
deadline_(io_service), connect_timeout_(boost::posix_time::seconds(60)), io_service_(io_service),
read_timeout_(boost::posix_time::seconds(60)), session_(nullptr), resolver_(io_service),
data_pending_(nullptr), data_pendinglen_(0), writing_(false), deadline_(io_service),
inside_callback_(false), stopped_(false) {} connect_timeout_(boost::posix_time::seconds(60)),
read_timeout_(boost::posix_time::seconds(60)),
session_(nullptr),
data_pending_(nullptr),
data_pendinglen_(0),
writing_(false),
inside_callback_(false),
stopped_(false) {}
session_impl::~session_impl() { session_impl::~session_impl() {
// finish up all active stream // finish up all active stream

View File

@ -69,10 +69,13 @@ public:
const boost::posix_time::time_duration &tls_handshake_timeout, const boost::posix_time::time_duration &tls_handshake_timeout,
const boost::posix_time::time_duration &read_timeout, const boost::posix_time::time_duration &read_timeout,
SocketArgs &&... args) SocketArgs &&... args)
: socket_(std::forward<SocketArgs>(args)...), mux_(mux), : socket_(std::forward<SocketArgs>(args)...),
mux_(mux),
deadline_(socket_.get_io_service()), deadline_(socket_.get_io_service()),
tls_handshake_timeout_(tls_handshake_timeout), tls_handshake_timeout_(tls_handshake_timeout),
read_timeout_(read_timeout), writing_(false), stopped_(false) {} read_timeout_(read_timeout),
writing_(false),
stopped_(false) {}
/// Start the first asynchronous operation for the connection. /// Start the first asynchronous operation for the connection.
void start() { void start() {

View File

@ -230,8 +230,14 @@ int on_frame_not_send_callback(nghttp2_session *session,
http2_handler::http2_handler(boost::asio::io_service &io_service, http2_handler::http2_handler(boost::asio::io_service &io_service,
boost::asio::ip::tcp::endpoint ep, boost::asio::ip::tcp::endpoint ep,
connection_write writefun, serve_mux &mux) connection_write writefun, serve_mux &mux)
: writefun_(writefun), mux_(mux), io_service_(io_service), remote_ep_(ep), : writefun_(writefun),
session_(nullptr), buf_(nullptr), buflen_(0), inside_callback_(false), mux_(mux),
io_service_(io_service),
remote_ep_(ep),
session_(nullptr),
buf_(nullptr),
buflen_(0),
inside_callback_(false),
tstamp_cached_(time(nullptr)), tstamp_cached_(time(nullptr)),
formatted_date_(util::http_date(tstamp_cached_)) {} formatted_date_(util::http_date(tstamp_cached_)) {}

View File

@ -38,7 +38,8 @@ namespace asio_http2 {
namespace server { namespace server {
http2_impl::http2_impl() http2_impl::http2_impl()
: num_threads_(1), backlog_(-1), : num_threads_(1),
backlog_(-1),
tls_handshake_timeout_(boost::posix_time::seconds(60)), tls_handshake_timeout_(boost::posix_time::seconds(60)),
read_timeout_(boost::posix_time::seconds(60)) {} read_timeout_(boost::posix_time::seconds(60)) {}

View File

@ -36,8 +36,11 @@ namespace asio_http2 {
namespace server { namespace server {
response_impl::response_impl() response_impl::response_impl()
: strm_(nullptr), generator_cb_(deferred_generator()), status_code_(200), : strm_(nullptr),
state_(response_state::INITIAL), pushed_(false), generator_cb_(deferred_generator()),
status_code_(200),
state_(response_state::INITIAL),
pushed_(false),
push_promise_sent_(false) {} push_promise_sent_(false) {}
unsigned int response_impl::status_code() const { return status_code_; } unsigned int response_impl::status_code() const { return status_code_; }

View File

@ -79,11 +79,24 @@ bool recorded(const std::chrono::steady_clock::time_point &t) {
} // namespace } // namespace
Config::Config() Config::Config()
: data_length(-1), addrs(nullptr), nreqs(1), nclients(1), nthreads(1), : data_length(-1),
max_concurrent_streams(-1), window_bits(30), connection_window_bits(30), addrs(nullptr),
rate(0), rate_period(1.0), conn_active_timeout(0.), nreqs(1),
conn_inactivity_timeout(0.), no_tls_proto(PROTO_HTTP2), data_fd(-1), nclients(1),
port(0), default_port(0), verbose(false), timing_script(false) {} nthreads(1),
max_concurrent_streams(-1),
window_bits(30),
connection_window_bits(30),
rate(0),
rate_period(1.0),
conn_active_timeout(0.),
conn_inactivity_timeout(0.),
no_tls_proto(PROTO_HTTP2),
data_fd(-1),
port(0),
default_port(0),
verbose(false),
timing_script(false) {}
Config::~Config() { Config::~Config() {
if (base_uri_unix) { if (base_uri_unix) {
@ -106,9 +119,18 @@ constexpr size_t MAX_SAMPLES = 1000000;
} // namespace } // namespace
Stats::Stats(size_t req_todo, size_t nclients) Stats::Stats(size_t req_todo, size_t nclients)
: req_todo(req_todo), req_started(0), req_done(0), req_success(0), : req_todo(req_todo),
req_status_success(0), req_failed(0), req_error(0), req_timedout(0), req_started(0),
bytes_total(0), bytes_head(0), bytes_head_decomp(0), bytes_body(0), req_done(0),
req_success(0),
req_status_success(0),
req_failed(0),
req_error(0),
req_timedout(0),
bytes_total(0),
bytes_head(0),
bytes_head_decomp(0),
bytes_body(0),
status() {} status() {}
Stream::Stream() : req_stat{}, status_success(-1) {} Stream::Stream() : req_stat{}, status_success(-1) {}
@ -290,9 +312,18 @@ void client_request_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) {
} // namespace } // namespace
Client::Client(uint32_t id, Worker *worker, size_t req_todo) Client::Client(uint32_t id, Worker *worker, size_t req_todo)
: cstat{}, worker(worker), ssl(nullptr), next_addr(config.addrs), : cstat{},
current_addr(nullptr), reqidx(0), state(CLIENT_IDLE), req_todo(req_todo), worker(worker),
req_started(0), req_done(0), id(id), fd(-1), ssl(nullptr),
next_addr(config.addrs),
current_addr(nullptr),
reqidx(0),
state(CLIENT_IDLE),
req_todo(req_todo),
req_started(0),
req_done(0),
id(id),
fd(-1),
new_connection_requested(false) { new_connection_requested(false) {
ev_io_init(&wev, writecb, 0, EV_WRITE); ev_io_init(&wev, writecb, 0, EV_WRITE);
ev_io_init(&rev, readcb, 0, EV_READ); ev_io_init(&rev, readcb, 0, EV_READ);
@ -1094,11 +1125,20 @@ void Client::try_new_connection() { new_connection_requested = true; }
Worker::Worker(uint32_t id, SSL_CTX *ssl_ctx, size_t req_todo, size_t nclients, Worker::Worker(uint32_t id, SSL_CTX *ssl_ctx, size_t req_todo, size_t nclients,
size_t rate, size_t max_samples, Config *config) size_t rate, size_t max_samples, Config *config)
: stats(req_todo, nclients), loop(ev_loop_new(0)), ssl_ctx(ssl_ctx), : stats(req_todo, nclients),
config(config), id(id), tls_info_report_done(false), loop(ev_loop_new(0)),
app_info_report_done(false), nconns_made(0), nclients(nclients), ssl_ctx(ssl_ctx),
nreqs_per_client(req_todo / nclients), nreqs_rem(req_todo % nclients), config(config),
rate(rate), max_samples(max_samples), next_client_id(0) { id(id),
tls_info_report_done(false),
app_info_report_done(false),
nconns_made(0),
nclients(nclients),
nreqs_per_client(req_todo / nclients),
nreqs_rem(req_todo % nclients),
rate(rate),
max_samples(max_samples),
next_client_id(0) {
if (!config->is_rate_mode()) { if (!config->is_rate_mode()) {
progress_interval = std::max(static_cast<size_t>(1), req_todo / 10); progress_interval = std::max(static_cast<size_t>(1), req_todo / 10);
} else { } else {

View File

@ -41,7 +41,10 @@ using namespace nghttp2;
namespace h2load { namespace h2load {
Http1Session::Http1Session(Client *client) Http1Session::Http1Session(Client *client)
: stream_req_counter_(1), stream_resp_counter_(1), client_(client), htp_(), : stream_req_counter_(1),
stream_resp_counter_(1),
client_(client),
htp_(),
complete_(false) { complete_(false) {
http_parser_init(&htp_, HTTP_RESPONSE); http_parser_init(&htp_, HTTP_RESPONSE);
htp_.data = this; htp_.data = this;

View File

@ -45,7 +45,9 @@ namespace nghttp2 {
struct Header { struct Header {
Header(std::string name, std::string value, bool no_index = false, Header(std::string name, std::string value, bool no_index = false,
int16_t token = -1) int16_t token = -1)
: name(std::move(name)), value(std::move(value)), token(token), : name(std::move(name)),
value(std::move(value)),
token(token),
no_index(no_index) {} no_index(no_index) {}
Header() : token(-1), no_index(false) {} Header() : token(-1), no_index(false) {}

View File

@ -32,13 +32,23 @@ namespace nghttp2 {
namespace util { namespace util {
EvbufferBuffer::EvbufferBuffer() EvbufferBuffer::EvbufferBuffer()
: evbuffer_(nullptr), bucket_(nullptr), buf_(nullptr), bufmax_(0), : evbuffer_(nullptr),
buflen_(0), limit_(0), writelen_(0) {} bucket_(nullptr),
buf_(nullptr),
bufmax_(0),
buflen_(0),
limit_(0),
writelen_(0) {}
EvbufferBuffer::EvbufferBuffer(evbuffer *evbuffer, uint8_t *buf, size_t bufmax, EvbufferBuffer::EvbufferBuffer(evbuffer *evbuffer, uint8_t *buf, size_t bufmax,
ssize_t limit) ssize_t limit)
: evbuffer_(evbuffer), bucket_(limit == -1 ? nullptr : evbuffer_new()), : evbuffer_(evbuffer),
buf_(buf), bufmax_(bufmax), buflen_(0), limit_(limit), writelen_(0) {} bucket_(limit == -1 ? nullptr : evbuffer_new()),
buf_(buf),
bufmax_(bufmax),
buflen_(0),
limit_(limit),
writelen_(0) {}
void EvbufferBuffer::reset(evbuffer *evbuffer, uint8_t *buf, size_t bufmax, void EvbufferBuffer::reset(evbuffer *evbuffer, uint8_t *buf, size_t bufmax,
ssize_t limit) { ssize_t limit) {

View File

@ -51,7 +51,9 @@ namespace nghttp2 {
template <size_t N> struct Memchunk { template <size_t N> struct Memchunk {
Memchunk(std::unique_ptr<Memchunk> next_chunk) Memchunk(std::unique_ptr<Memchunk> next_chunk)
: pos(std::begin(buf)), last(pos), knext(std::move(next_chunk)), : pos(std::begin(buf)),
last(pos),
knext(std::move(next_chunk)),
next(nullptr) {} next(nullptr) {}
size_t len() const { return last - pos; } size_t len() const { return last - pos; }
size_t left() const { return std::end(buf) - last; } size_t left() const { return std::end(buf) - last; }
@ -290,8 +292,12 @@ template <typename Memchunk> struct Memchunks {
// Wrapper around Memchunks to offer "peeking" functionality. // Wrapper around Memchunks to offer "peeking" functionality.
template <typename Memchunk> struct PeekMemchunks { template <typename Memchunk> struct PeekMemchunks {
PeekMemchunks(Pool<Memchunk> *pool) PeekMemchunks(Pool<Memchunk> *pool)
: memchunks(pool), cur(nullptr), cur_pos(nullptr), cur_last(nullptr), : memchunks(pool),
len(0), peeking(true) {} cur(nullptr),
cur_pos(nullptr),
cur_last(nullptr),
len(0),
peeking(true) {}
PeekMemchunks(const PeekMemchunks &) = delete; PeekMemchunks(const PeekMemchunks &) = delete;
PeekMemchunks(PeekMemchunks &&other) noexcept PeekMemchunks(PeekMemchunks &&other) noexcept
: memchunks(std::move(other.memchunks)), : memchunks(std::move(other.memchunks)),

View File

@ -94,13 +94,26 @@ constexpr auto anchors = std::array<Anchor, 5>{{
Config::Config() Config::Config()
: header_table_size(-1), : header_table_size(-1),
min_header_table_size(std::numeric_limits<uint32_t>::max()), padding(0), min_header_table_size(std::numeric_limits<uint32_t>::max()),
max_concurrent_streams(100), peer_max_concurrent_streams(100), padding(0),
weight(NGHTTP2_DEFAULT_WEIGHT), multiply(1), timeout(0.), window_bits(-1), max_concurrent_streams(100),
connection_window_bits(-1), verbose(0), null_out(false), peer_max_concurrent_streams(100),
remote_name(false), get_assets(false), stat(false), upgrade(false), weight(NGHTTP2_DEFAULT_WEIGHT),
continuation(false), no_content_length(false), no_dep(false), multiply(1),
hexdump(false), no_push(false) { timeout(0.),
window_bits(-1),
connection_window_bits(-1),
verbose(0),
null_out(false),
remote_name(false),
get_assets(false),
stat(false),
upgrade(false),
continuation(false),
no_content_length(false),
no_dep(false),
hexdump(false),
no_push(false) {
nghttp2_option_new(&http2_option); nghttp2_option_new(&http2_option);
nghttp2_option_set_peer_max_concurrent_streams(http2_option, nghttp2_option_set_peer_max_concurrent_streams(http2_option,
peer_max_concurrent_streams); peer_max_concurrent_streams);
@ -133,9 +146,18 @@ std::string strip_fragment(const char *raw_uri) {
Request::Request(const std::string &uri, const http_parser_url &u, Request::Request(const std::string &uri, const http_parser_url &u,
const nghttp2_data_provider *data_prd, int64_t data_length, const nghttp2_data_provider *data_prd, int64_t data_length,
const nghttp2_priority_spec &pri_spec, int level) const nghttp2_priority_spec &pri_spec, int level)
: uri(uri), u(u), pri_spec(pri_spec), data_length(data_length), : uri(uri),
data_offset(0), response_len(0), inflater(nullptr), html_parser(nullptr), u(u),
data_prd(data_prd), stream_id(-1), status(0), level(level), pri_spec(pri_spec),
data_length(data_length),
data_offset(0),
response_len(0),
inflater(nullptr),
html_parser(nullptr),
data_prd(data_prd),
stream_id(-1),
status(0),
level(level),
expect_final_response(false) { expect_final_response(false) {
http2::init_hdidx(res_hdidx); http2::init_hdidx(res_hdidx);
http2::init_hdidx(req_hdidx); http2::init_hdidx(req_hdidx);
@ -467,10 +489,20 @@ void settings_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) {
HttpClient::HttpClient(const nghttp2_session_callbacks *callbacks, HttpClient::HttpClient(const nghttp2_session_callbacks *callbacks,
struct ev_loop *loop, SSL_CTX *ssl_ctx) struct ev_loop *loop, SSL_CTX *ssl_ctx)
: session(nullptr), callbacks(callbacks), loop(loop), ssl_ctx(ssl_ctx), : session(nullptr),
ssl(nullptr), addrs(nullptr), next_addr(nullptr), cur_addr(nullptr), callbacks(callbacks),
complete(0), success(0), settings_payloadlen(0), state(ClientState::IDLE), loop(loop),
upgrade_response_status_code(0), fd(-1), ssl_ctx(ssl_ctx),
ssl(nullptr),
addrs(nullptr),
next_addr(nullptr),
cur_addr(nullptr),
complete(0),
success(0),
settings_payloadlen(0),
state(ClientState::IDLE),
upgrade_response_status_code(0),
fd(-1),
upgrade_response_complete(false) { upgrade_response_complete(false) {
ev_io_init(&wev, writecb, 0, EV_WRITE); ev_io_init(&wev, writecb, 0, EV_WRITE);
ev_io_init(&rev, readcb, 0, EV_READ); ev_io_init(&rev, readcb, 0, EV_READ);

View File

@ -123,7 +123,9 @@ namespace shrpx {
struct SignalServer { struct SignalServer {
SignalServer() SignalServer()
: ipc_fd{{-1, -1}}, server_fd(-1), server_fd6(-1), : ipc_fd{{-1, -1}},
server_fd(-1),
server_fd6(-1),
worker_process_pid(-1) {} worker_process_pid(-1) {}
~SignalServer() { ~SignalServer() {
if (server_fd6 != -1) { if (server_fd6 != -1) {

View File

@ -390,7 +390,9 @@ ClientHandler::ClientHandler(Worker *worker, int fd, SSL *ssl,
? make_unique<std::vector<ssize_t>>( ? make_unique<std::vector<ssize_t>>(
get_config()->conn.downstream.addr_groups.size(), -1) get_config()->conn.downstream.addr_groups.size(), -1)
: nullptr), : nullptr),
ipaddr_(ipaddr), port_(port), worker_(worker), ipaddr_(ipaddr),
port_(port),
worker_(worker),
left_connhd_len_(NGHTTP2_CLIENT_MAGIC_LEN), left_connhd_len_(NGHTTP2_CLIENT_MAGIC_LEN),
should_close_after_write_(false) { should_close_after_write_(false) {

View File

@ -81,8 +81,11 @@ TicketKeys::~TicketKeys() {
} }
DownstreamAddr::DownstreamAddr(const DownstreamAddr &other) DownstreamAddr::DownstreamAddr(const DownstreamAddr &other)
: addr(other.addr), host(other.host), hostport(other.hostport), : addr(other.addr),
port(other.port), host_unix(other.host_unix) {} host(other.host),
hostport(other.hostport),
port(other.port),
host_unix(other.host_unix) {}
DownstreamAddr &DownstreamAddr::operator=(const DownstreamAddr &other) { DownstreamAddr &DownstreamAddr::operator=(const DownstreamAddr &other) {
if (this == &other) { if (this == &other) {

View File

@ -51,8 +51,12 @@ Connection::Connection(struct ev_loop *loop, int fd, SSL *ssl,
: tls{DefaultMemchunks(mcpool), DefaultPeekMemchunks(mcpool)}, : tls{DefaultMemchunks(mcpool), DefaultPeekMemchunks(mcpool)},
wlimit(loop, &wev, write_limit.rate, write_limit.burst), wlimit(loop, &wev, write_limit.rate, write_limit.burst),
rlimit(loop, &rev, read_limit.rate, read_limit.burst, this), rlimit(loop, &rev, read_limit.rate, read_limit.burst, this),
writecb(writecb), readcb(readcb), timeoutcb(timeoutcb), loop(loop), writecb(writecb),
data(data), fd(fd), readcb(readcb),
timeoutcb(timeoutcb),
loop(loop),
data(data),
fd(fd),
tls_dyn_rec_warmup_threshold(tls_dyn_rec_warmup_threshold), tls_dyn_rec_warmup_threshold(tls_dyn_rec_warmup_threshold),
tls_dyn_rec_idle_timeout(tls_dyn_rec_idle_timeout) { tls_dyn_rec_idle_timeout(tls_dyn_rec_idle_timeout) {

View File

@ -107,9 +107,12 @@ std::random_device rd;
} // namespace } // namespace
ConnectionHandler::ConnectionHandler(struct ev_loop *loop) ConnectionHandler::ConnectionHandler(struct ev_loop *loop)
: gen_(rd()), single_worker_(nullptr), loop_(loop), : gen_(rd()),
single_worker_(nullptr),
loop_(loop),
tls_ticket_key_memcached_get_retry_count_(0), tls_ticket_key_memcached_get_retry_count_(0),
tls_ticket_key_memcached_fail_count_(0), worker_round_robin_cnt_(0), tls_ticket_key_memcached_fail_count_(0),
worker_round_robin_cnt_(0),
graceful_shutdown_(false) { graceful_shutdown_(false) {
ev_timer_init(&disable_acceptor_timer_, acceptor_disable_cb, 0., 0.); ev_timer_init(&disable_acceptor_timer_, acceptor_disable_cb, 0., 0.);
disable_acceptor_timer_.data = this; disable_acceptor_timer_.data = this;

View File

@ -113,15 +113,26 @@ void downstream_wtimeoutcb(struct ev_loop *loop, ev_timer *w, int revents) {
// upstream could be nullptr for unittests // upstream could be nullptr for unittests
Downstream::Downstream(Upstream *upstream, MemchunkPool *mcpool, Downstream::Downstream(Upstream *upstream, MemchunkPool *mcpool,
int32_t stream_id) int32_t stream_id)
: dlnext(nullptr), dlprev(nullptr), response_sent_body_length(0), : dlnext(nullptr),
dlprev(nullptr),
response_sent_body_length(0),
request_start_time_(std::chrono::high_resolution_clock::now()), request_start_time_(std::chrono::high_resolution_clock::now()),
request_buf_(mcpool), response_buf_(mcpool), upstream_(upstream), request_buf_(mcpool),
blocked_link_(nullptr), num_retry_(0), stream_id_(stream_id), response_buf_(mcpool),
assoc_stream_id_(-1), downstream_stream_id_(-1), upstream_(upstream),
blocked_link_(nullptr),
num_retry_(0),
stream_id_(stream_id),
assoc_stream_id_(-1),
downstream_stream_id_(-1),
response_rst_stream_error_code_(NGHTTP2_NO_ERROR), response_rst_stream_error_code_(NGHTTP2_NO_ERROR),
request_state_(INITIAL), response_state_(INITIAL), request_state_(INITIAL),
dispatch_state_(DISPATCH_NONE), upgraded_(false), chunked_request_(false), response_state_(INITIAL),
chunked_response_(false), expect_final_response_(false), dispatch_state_(DISPATCH_NONE),
upgraded_(false),
chunked_request_(false),
chunked_response_(false),
expect_final_response_(false),
request_pending_(false) { request_pending_(false) {
auto &timeoutconf = get_config()->http2.timeout; auto &timeoutconf = get_config()->http2.timeout;

View File

@ -52,7 +52,9 @@ struct BlockedLink;
class FieldStore { class FieldStore {
public: public:
FieldStore(size_t headers_initial_capacity) FieldStore(size_t headers_initial_capacity)
: content_length(-1), buffer_size_(0), header_key_prev_(false), : content_length(-1),
buffer_size_(0),
header_key_prev_(false),
trailer_key_prev_(false) { trailer_key_prev_(false) {
http2::init_hdidx(hdidx_); http2::init_hdidx(hdidx_);
headers_.reserve(headers_initial_capacity); headers_.reserve(headers_initial_capacity);
@ -124,10 +126,17 @@ private:
struct Request { struct Request {
Request() Request()
: fs(16), recv_body_length(0), unconsumed_body_length(0), method(-1), : fs(16),
http_major(1), http_minor(1), upgrade_request(false), recv_body_length(0),
http2_upgrade_seen(false), connection_close(false), unconsumed_body_length(0),
http2_expect_body(false), no_authority(false) {} method(-1),
http_major(1),
http_minor(1),
upgrade_request(false),
http2_upgrade_seen(false),
connection_close(false),
http2_expect_body(false),
no_authority(false) {}
void consume(size_t len) { void consume(size_t len) {
assert(unconsumed_body_length >= len); assert(unconsumed_body_length >= len);
@ -173,8 +182,13 @@ struct Request {
struct Response { struct Response {
Response() Response()
: fs(32), recv_body_length(0), unconsumed_body_length(0), http_status(0), : fs(32),
http_major(1), http_minor(1), connection_close(false) {} recv_body_length(0),
unconsumed_body_length(0),
http_status(0),
http_major(1),
http_minor(1),
connection_close(false) {}
void consume(size_t len) { void consume(size_t len) {
assert(unconsumed_body_length >= len); assert(unconsumed_body_length >= len);

View File

@ -46,8 +46,11 @@ namespace shrpx {
Http2DownstreamConnection::Http2DownstreamConnection( Http2DownstreamConnection::Http2DownstreamConnection(
DownstreamConnectionPool *dconn_pool, Http2Session *http2session) DownstreamConnectionPool *dconn_pool, Http2Session *http2session)
: DownstreamConnection(dconn_pool), dlnext(nullptr), dlprev(nullptr), : DownstreamConnection(dconn_pool),
http2session_(http2session), sd_(nullptr) {} dlnext(nullptr),
dlprev(nullptr),
http2session_(http2session),
sd_(nullptr) {}
Http2DownstreamConnection::~Http2DownstreamConnection() { Http2DownstreamConnection::~Http2DownstreamConnection() {
if (LOG_ENABLED(INFO)) { if (LOG_ENABLED(INFO)) {

View File

@ -150,10 +150,18 @@ Http2Session::Http2Session(struct ev_loop *loop, SSL_CTX *ssl_ctx,
get_config()->conn.downstream.timeout.read, {}, {}, writecb, readcb, get_config()->conn.downstream.timeout.read, {}, {}, writecb, readcb,
timeoutcb, this, get_config()->tls.dyn_rec.warmup_threshold, timeoutcb, this, get_config()->tls.dyn_rec.warmup_threshold,
get_config()->tls.dyn_rec.idle_timeout), get_config()->tls.dyn_rec.idle_timeout),
worker_(worker), connect_blocker_(connect_blocker), ssl_ctx_(ssl_ctx), worker_(worker),
session_(nullptr), data_pending_(nullptr), data_pendinglen_(0), connect_blocker_(connect_blocker),
addr_idx_(0), group_(group), index_(idx), state_(DISCONNECTED), ssl_ctx_(ssl_ctx),
connection_check_state_(CONNECTION_CHECK_NONE), flow_control_(false) { session_(nullptr),
data_pending_(nullptr),
data_pendinglen_(0),
addr_idx_(0),
group_(group),
index_(idx),
state_(DISCONNECTED),
connection_check_state_(CONNECTION_CHECK_NONE),
flow_control_(false) {
read_ = write_ = &Http2Session::noop; read_ = write_ = &Http2Session::noop;
on_read_ = on_write_ = &Http2Session::noop; on_read_ = on_write_ = &Http2Session::noop;

View File

@ -826,7 +826,9 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
? get_config()->conn.downstream.connections_per_frontend ? get_config()->conn.downstream.connections_per_frontend
: 0, : 0,
!get_config()->http2_proxy), !get_config()->http2_proxy),
handler_(handler), session_(nullptr), shutdown_handled_(false) { handler_(handler),
session_(nullptr),
shutdown_handled_(false) {
int rv; int rv;

View File

@ -118,7 +118,10 @@ HttpDownstreamConnection::HttpDownstreamConnection(
get_config()->conn.downstream.timeout.read, {}, {}, connectcb, get_config()->conn.downstream.timeout.read, {}, {}, connectcb,
readcb, timeoutcb, this, get_config()->tls.dyn_rec.warmup_threshold, readcb, timeoutcb, this, get_config()->tls.dyn_rec.warmup_threshold,
get_config()->tls.dyn_rec.idle_timeout), get_config()->tls.dyn_rec.idle_timeout),
ioctrl_(&conn_.rlimit), response_htp_{0}, group_(group), addr_idx_(0), ioctrl_(&conn_.rlimit),
response_htp_{0},
group_(group),
addr_idx_(0),
connected_(false) {} connected_(false) {}
HttpDownstreamConnection::~HttpDownstreamConnection() {} HttpDownstreamConnection::~HttpDownstreamConnection() {}

View File

@ -49,7 +49,8 @@ using namespace nghttp2;
namespace shrpx { namespace shrpx {
HttpsUpstream::HttpsUpstream(ClientHandler *handler) HttpsUpstream::HttpsUpstream(ClientHandler *handler)
: handler_(handler), current_header_length_(0), : handler_(handler),
current_header_length_(0),
ioctrl_(handler->get_rlimit()) { ioctrl_(handler->get_rlimit()) {
http_parser_init(&htp_, HTTP_REQUEST); http_parser_init(&htp_, HTTP_REQUEST);
htp_.data = this; htp_.data = this;

View File

@ -94,7 +94,10 @@ MemcachedConnection::MemcachedConnection(const Address *addr,
struct ev_loop *loop) struct ev_loop *loop)
: conn_(loop, -1, nullptr, nullptr, write_timeout, read_timeout, {}, {}, : conn_(loop, -1, nullptr, nullptr, write_timeout, read_timeout, {}, {},
connectcb, readcb, timeoutcb, this, 0, 0.), connectcb, readcb, timeoutcb, this, 0, 0.),
parse_state_{}, addr_(addr), sendsum_(0), connected_(false) {} parse_state_{},
addr_(addr),
sendsum_(0),
connected_(false) {}
MemcachedConnection::~MemcachedConnection() { disconnect(); } MemcachedConnection::~MemcachedConnection() { disconnect(); }

View File

@ -39,8 +39,13 @@ void regencb(struct ev_loop *loop, ev_timer *w, int revents) {
RateLimit::RateLimit(struct ev_loop *loop, ev_io *w, size_t rate, size_t burst, RateLimit::RateLimit(struct ev_loop *loop, ev_io *w, size_t rate, size_t burst,
Connection *conn) Connection *conn)
: w_(w), loop_(loop), conn_(conn), rate_(rate), burst_(burst), : w_(w),
avail_(burst), startw_req_(false) { loop_(loop),
conn_(conn),
rate_(rate),
burst_(burst),
avail_(burst),
startw_req_(false) {
ev_timer_init(&t_, regencb, 0., 1.); ev_timer_init(&t_, regencb, 0., 1.);
t_.data = this; t_.data = this;
if (rate_ > 0) { if (rate_ > 0) {

View File

@ -504,7 +504,8 @@ SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler)
? get_config()->conn.downstream.connections_per_frontend ? get_config()->conn.downstream.connections_per_frontend
: 0, : 0,
!get_config()->http2_proxy), !get_config()->http2_proxy),
handler_(handler), session_(nullptr) { handler_(handler),
session_(nullptr) {
spdylay_session_callbacks callbacks{}; spdylay_session_callbacks callbacks{};
callbacks.send_callback = send_callback; callbacks.send_callback = send_callback;
callbacks.recv_callback = recv_callback; callbacks.recv_callback = recv_callback;

View File

@ -72,8 +72,11 @@ Worker::Worker(struct ev_loop *loop, SSL_CTX *sv_ssl_ctx, SSL_CTX *cl_ssl_ctx,
: randgen_(rd()), : randgen_(rd()),
dconn_pool_(get_config()->conn.downstream.addr_groups.size()), dconn_pool_(get_config()->conn.downstream.addr_groups.size()),
worker_stat_(get_config()->conn.downstream.addr_groups.size()), worker_stat_(get_config()->conn.downstream.addr_groups.size()),
dgrps_(get_config()->conn.downstream.addr_groups.size()), loop_(loop), dgrps_(get_config()->conn.downstream.addr_groups.size()),
sv_ssl_ctx_(sv_ssl_ctx), cl_ssl_ctx_(cl_ssl_ctx), cert_tree_(cert_tree), loop_(loop),
sv_ssl_ctx_(sv_ssl_ctx),
cl_ssl_ctx_(cl_ssl_ctx),
cert_tree_(cert_tree),
ticket_keys_(ticket_keys), ticket_keys_(ticket_keys),
connect_blocker_(make_unique<ConnectBlocker>(loop_)), connect_blocker_(make_unique<ConnectBlocker>(loop_)),
graceful_shutdown_(false) { graceful_shutdown_(false) {