Enable ConstructorInitializerAllOnOneLineOrOnePerLine for better diff
This commit is contained in:
parent
c5f3eee3be
commit
85bb37ab7c
|
@ -17,7 +17,7 @@ BreakBeforeTernaryOperators: true
|
|||
BreakConstructorInitializersBeforeComma: false
|
||||
BinPackParameters: true
|
||||
ColumnLimit: 80
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
DerivePointerAlignment: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
IndentCaseLabels: false
|
||||
|
|
|
@ -101,12 +101,24 @@ template <typename Array> void append_nv(Stream *stream, const Array &nva) {
|
|||
} // namespace
|
||||
|
||||
Config::Config()
|
||||
: mime_types_file("/etc/mime.types"), stream_read_timeout(1_min),
|
||||
stream_write_timeout(1_min), data_ptr(nullptr), padding(0), 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) {}
|
||||
: mime_types_file("/etc/mime.types"),
|
||||
stream_read_timeout(1_min),
|
||||
stream_write_timeout(1_min),
|
||||
data_ptr(nullptr),
|
||||
padding(0),
|
||||
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() {}
|
||||
|
||||
|
@ -225,8 +237,13 @@ class Sessions {
|
|||
public:
|
||||
Sessions(HttpServer *sv, struct ev_loop *loop, const Config *config,
|
||||
SSL_CTX *ssl_ctx)
|
||||
: sv_(sv), loop_(loop), config_(config), ssl_ctx_(ssl_ctx),
|
||||
callbacks_(nullptr), next_session_id_(1), tstamp_cached_(ev_now(loop)),
|
||||
: sv_(sv),
|
||||
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_)) {
|
||||
nghttp2_session_callbacks_new(&callbacks_);
|
||||
|
||||
|
@ -424,8 +441,12 @@ void release_fd_cb(struct ev_loop *loop, ev_timer *w, int revents) {
|
|||
} // namespace
|
||||
|
||||
Stream::Stream(Http2Handler *handler, int32_t stream_id)
|
||||
: handler(handler), file_ent(nullptr), body_length(0), body_offset(0),
|
||||
stream_id(stream_id), echo_upload(false) {
|
||||
: handler(handler),
|
||||
file_ent(nullptr),
|
||||
body_length(0),
|
||||
body_offset(0),
|
||||
stream_id(stream_id),
|
||||
echo_upload(false) {
|
||||
auto config = handler->get_config();
|
||||
ev_timer_init(&rtimer, stream_timeout_cb, 0., config->stream_read_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,
|
||||
int64_t session_id)
|
||||
: session_id_(session_id), session_(nullptr), sessions_(sessions),
|
||||
ssl_(ssl), data_pending_(nullptr), data_pendinglen_(0), fd_(fd) {
|
||||
: session_id_(session_id),
|
||||
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_io_init(&wev_, writecb, fd, EV_WRITE);
|
||||
ev_io_init(&rev_, readcb, fd, EV_READ);
|
||||
|
|
|
@ -87,9 +87,16 @@ struct FileEntry {
|
|||
FileEntry(std::string path, int64_t length, int64_t mtime, int fd,
|
||||
const std::string *content_type, ev_tstamp last_valid,
|
||||
bool stale = false)
|
||||
: path(std::move(path)), length(length), mtime(mtime),
|
||||
last_valid(last_valid), content_type(content_type), dlnext(nullptr),
|
||||
dlprev(nullptr), fd(fd), usecount(1), stale(stale) {}
|
||||
: path(std::move(path)),
|
||||
length(length),
|
||||
mtime(mtime),
|
||||
last_valid(last_valid),
|
||||
content_type(content_type),
|
||||
dlnext(nullptr),
|
||||
dlprev(nullptr),
|
||||
fd(fd),
|
||||
usecount(1),
|
||||
stale(stale) {}
|
||||
std::string path;
|
||||
std::multimap<std::string, std::unique_ptr<FileEntry>>::iterator it;
|
||||
int64_t length;
|
||||
|
|
|
@ -39,11 +39,18 @@ namespace asio_http2 {
|
|||
namespace client {
|
||||
|
||||
session_impl::session_impl(boost::asio::io_service &io_service)
|
||||
: wblen_(0), io_service_(io_service), resolver_(io_service),
|
||||
deadline_(io_service), 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) {}
|
||||
: wblen_(0),
|
||||
io_service_(io_service),
|
||||
resolver_(io_service),
|
||||
deadline_(io_service),
|
||||
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() {
|
||||
// finish up all active stream
|
||||
|
|
|
@ -69,10 +69,13 @@ public:
|
|||
const boost::posix_time::time_duration &tls_handshake_timeout,
|
||||
const boost::posix_time::time_duration &read_timeout,
|
||||
SocketArgs &&... args)
|
||||
: socket_(std::forward<SocketArgs>(args)...), mux_(mux),
|
||||
: socket_(std::forward<SocketArgs>(args)...),
|
||||
mux_(mux),
|
||||
deadline_(socket_.get_io_service()),
|
||||
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.
|
||||
void start() {
|
||||
|
|
|
@ -230,8 +230,14 @@ int on_frame_not_send_callback(nghttp2_session *session,
|
|||
http2_handler::http2_handler(boost::asio::io_service &io_service,
|
||||
boost::asio::ip::tcp::endpoint ep,
|
||||
connection_write writefun, serve_mux &mux)
|
||||
: writefun_(writefun), mux_(mux), io_service_(io_service), remote_ep_(ep),
|
||||
session_(nullptr), buf_(nullptr), buflen_(0), inside_callback_(false),
|
||||
: writefun_(writefun),
|
||||
mux_(mux),
|
||||
io_service_(io_service),
|
||||
remote_ep_(ep),
|
||||
session_(nullptr),
|
||||
buf_(nullptr),
|
||||
buflen_(0),
|
||||
inside_callback_(false),
|
||||
tstamp_cached_(time(nullptr)),
|
||||
formatted_date_(util::http_date(tstamp_cached_)) {}
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ namespace asio_http2 {
|
|||
namespace server {
|
||||
|
||||
http2_impl::http2_impl()
|
||||
: num_threads_(1), backlog_(-1),
|
||||
: num_threads_(1),
|
||||
backlog_(-1),
|
||||
tls_handshake_timeout_(boost::posix_time::seconds(60)),
|
||||
read_timeout_(boost::posix_time::seconds(60)) {}
|
||||
|
||||
|
|
|
@ -36,8 +36,11 @@ namespace asio_http2 {
|
|||
namespace server {
|
||||
|
||||
response_impl::response_impl()
|
||||
: strm_(nullptr), generator_cb_(deferred_generator()), status_code_(200),
|
||||
state_(response_state::INITIAL), pushed_(false),
|
||||
: strm_(nullptr),
|
||||
generator_cb_(deferred_generator()),
|
||||
status_code_(200),
|
||||
state_(response_state::INITIAL),
|
||||
pushed_(false),
|
||||
push_promise_sent_(false) {}
|
||||
|
||||
unsigned int response_impl::status_code() const { return status_code_; }
|
||||
|
|
|
@ -79,11 +79,24 @@ bool recorded(const std::chrono::steady_clock::time_point &t) {
|
|||
} // namespace
|
||||
|
||||
Config::Config()
|
||||
: data_length(-1), addrs(nullptr), nreqs(1), nclients(1), 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) {}
|
||||
: data_length(-1),
|
||||
addrs(nullptr),
|
||||
nreqs(1),
|
||||
nclients(1),
|
||||
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() {
|
||||
if (base_uri_unix) {
|
||||
|
@ -106,9 +119,18 @@ constexpr size_t MAX_SAMPLES = 1000000;
|
|||
} // namespace
|
||||
|
||||
Stats::Stats(size_t req_todo, size_t nclients)
|
||||
: req_todo(req_todo), req_started(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),
|
||||
: req_todo(req_todo),
|
||||
req_started(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() {}
|
||||
|
||||
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
|
||||
|
||||
Client::Client(uint32_t id, Worker *worker, size_t req_todo)
|
||||
: cstat{}, worker(worker), 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),
|
||||
: cstat{},
|
||||
worker(worker),
|
||||
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) {
|
||||
ev_io_init(&wev, writecb, 0, EV_WRITE);
|
||||
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,
|
||||
size_t rate, size_t max_samples, Config *config)
|
||||
: stats(req_todo, nclients), loop(ev_loop_new(0)), ssl_ctx(ssl_ctx),
|
||||
config(config), 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) {
|
||||
: stats(req_todo, nclients),
|
||||
loop(ev_loop_new(0)),
|
||||
ssl_ctx(ssl_ctx),
|
||||
config(config),
|
||||
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()) {
|
||||
progress_interval = std::max(static_cast<size_t>(1), req_todo / 10);
|
||||
} else {
|
||||
|
|
|
@ -41,7 +41,10 @@ using namespace nghttp2;
|
|||
namespace h2load {
|
||||
|
||||
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) {
|
||||
http_parser_init(&htp_, HTTP_RESPONSE);
|
||||
htp_.data = this;
|
||||
|
|
|
@ -45,7 +45,9 @@ namespace nghttp2 {
|
|||
struct Header {
|
||||
Header(std::string name, std::string value, bool no_index = false,
|
||||
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) {}
|
||||
|
||||
Header() : token(-1), no_index(false) {}
|
||||
|
|
|
@ -32,13 +32,23 @@ namespace nghttp2 {
|
|||
namespace util {
|
||||
|
||||
EvbufferBuffer::EvbufferBuffer()
|
||||
: evbuffer_(nullptr), bucket_(nullptr), buf_(nullptr), bufmax_(0),
|
||||
buflen_(0), limit_(0), writelen_(0) {}
|
||||
: evbuffer_(nullptr),
|
||||
bucket_(nullptr),
|
||||
buf_(nullptr),
|
||||
bufmax_(0),
|
||||
buflen_(0),
|
||||
limit_(0),
|
||||
writelen_(0) {}
|
||||
|
||||
EvbufferBuffer::EvbufferBuffer(evbuffer *evbuffer, uint8_t *buf, size_t bufmax,
|
||||
ssize_t limit)
|
||||
: evbuffer_(evbuffer), bucket_(limit == -1 ? nullptr : evbuffer_new()),
|
||||
buf_(buf), bufmax_(bufmax), buflen_(0), limit_(limit), writelen_(0) {}
|
||||
: evbuffer_(evbuffer),
|
||||
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,
|
||||
ssize_t limit) {
|
||||
|
|
|
@ -51,7 +51,9 @@ namespace nghttp2 {
|
|||
|
||||
template <size_t N> struct Memchunk {
|
||||
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) {}
|
||||
size_t len() const { return last - pos; }
|
||||
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.
|
||||
template <typename Memchunk> struct PeekMemchunks {
|
||||
PeekMemchunks(Pool<Memchunk> *pool)
|
||||
: memchunks(pool), cur(nullptr), cur_pos(nullptr), cur_last(nullptr),
|
||||
len(0), peeking(true) {}
|
||||
: memchunks(pool),
|
||||
cur(nullptr),
|
||||
cur_pos(nullptr),
|
||||
cur_last(nullptr),
|
||||
len(0),
|
||||
peeking(true) {}
|
||||
PeekMemchunks(const PeekMemchunks &) = delete;
|
||||
PeekMemchunks(PeekMemchunks &&other) noexcept
|
||||
: memchunks(std::move(other.memchunks)),
|
||||
|
|
|
@ -94,13 +94,26 @@ constexpr auto anchors = std::array<Anchor, 5>{{
|
|||
|
||||
Config::Config()
|
||||
: header_table_size(-1),
|
||||
min_header_table_size(std::numeric_limits<uint32_t>::max()), padding(0),
|
||||
max_concurrent_streams(100), peer_max_concurrent_streams(100),
|
||||
weight(NGHTTP2_DEFAULT_WEIGHT), multiply(1), 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) {
|
||||
min_header_table_size(std::numeric_limits<uint32_t>::max()),
|
||||
padding(0),
|
||||
max_concurrent_streams(100),
|
||||
peer_max_concurrent_streams(100),
|
||||
weight(NGHTTP2_DEFAULT_WEIGHT),
|
||||
multiply(1),
|
||||
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_set_peer_max_concurrent_streams(http2_option,
|
||||
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,
|
||||
const nghttp2_data_provider *data_prd, int64_t data_length,
|
||||
const nghttp2_priority_spec &pri_spec, int level)
|
||||
: uri(uri), u(u), 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),
|
||||
: uri(uri),
|
||||
u(u),
|
||||
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) {
|
||||
http2::init_hdidx(res_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,
|
||||
struct ev_loop *loop, SSL_CTX *ssl_ctx)
|
||||
: session(nullptr), callbacks(callbacks), loop(loop), 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),
|
||||
: session(nullptr),
|
||||
callbacks(callbacks),
|
||||
loop(loop),
|
||||
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) {
|
||||
ev_io_init(&wev, writecb, 0, EV_WRITE);
|
||||
ev_io_init(&rev, readcb, 0, EV_READ);
|
||||
|
|
|
@ -123,7 +123,9 @@ namespace shrpx {
|
|||
|
||||
struct 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) {}
|
||||
~SignalServer() {
|
||||
if (server_fd6 != -1) {
|
||||
|
|
|
@ -390,7 +390,9 @@ ClientHandler::ClientHandler(Worker *worker, int fd, SSL *ssl,
|
|||
? make_unique<std::vector<ssize_t>>(
|
||||
get_config()->conn.downstream.addr_groups.size(), -1)
|
||||
: nullptr),
|
||||
ipaddr_(ipaddr), port_(port), worker_(worker),
|
||||
ipaddr_(ipaddr),
|
||||
port_(port),
|
||||
worker_(worker),
|
||||
left_connhd_len_(NGHTTP2_CLIENT_MAGIC_LEN),
|
||||
should_close_after_write_(false) {
|
||||
|
||||
|
|
|
@ -81,8 +81,11 @@ TicketKeys::~TicketKeys() {
|
|||
}
|
||||
|
||||
DownstreamAddr::DownstreamAddr(const DownstreamAddr &other)
|
||||
: addr(other.addr), host(other.host), hostport(other.hostport),
|
||||
port(other.port), host_unix(other.host_unix) {}
|
||||
: addr(other.addr),
|
||||
host(other.host),
|
||||
hostport(other.hostport),
|
||||
port(other.port),
|
||||
host_unix(other.host_unix) {}
|
||||
|
||||
DownstreamAddr &DownstreamAddr::operator=(const DownstreamAddr &other) {
|
||||
if (this == &other) {
|
||||
|
|
|
@ -51,8 +51,12 @@ Connection::Connection(struct ev_loop *loop, int fd, SSL *ssl,
|
|||
: tls{DefaultMemchunks(mcpool), DefaultPeekMemchunks(mcpool)},
|
||||
wlimit(loop, &wev, write_limit.rate, write_limit.burst),
|
||||
rlimit(loop, &rev, read_limit.rate, read_limit.burst, this),
|
||||
writecb(writecb), readcb(readcb), timeoutcb(timeoutcb), loop(loop),
|
||||
data(data), fd(fd),
|
||||
writecb(writecb),
|
||||
readcb(readcb),
|
||||
timeoutcb(timeoutcb),
|
||||
loop(loop),
|
||||
data(data),
|
||||
fd(fd),
|
||||
tls_dyn_rec_warmup_threshold(tls_dyn_rec_warmup_threshold),
|
||||
tls_dyn_rec_idle_timeout(tls_dyn_rec_idle_timeout) {
|
||||
|
||||
|
|
|
@ -107,9 +107,12 @@ std::random_device rd;
|
|||
} // namespace
|
||||
|
||||
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_fail_count_(0), worker_round_robin_cnt_(0),
|
||||
tls_ticket_key_memcached_fail_count_(0),
|
||||
worker_round_robin_cnt_(0),
|
||||
graceful_shutdown_(false) {
|
||||
ev_timer_init(&disable_acceptor_timer_, acceptor_disable_cb, 0., 0.);
|
||||
disable_acceptor_timer_.data = this;
|
||||
|
|
|
@ -113,15 +113,26 @@ void downstream_wtimeoutcb(struct ev_loop *loop, ev_timer *w, int revents) {
|
|||
// upstream could be nullptr for unittests
|
||||
Downstream::Downstream(Upstream *upstream, MemchunkPool *mcpool,
|
||||
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_buf_(mcpool), response_buf_(mcpool), upstream_(upstream),
|
||||
blocked_link_(nullptr), num_retry_(0), stream_id_(stream_id),
|
||||
assoc_stream_id_(-1), downstream_stream_id_(-1),
|
||||
request_buf_(mcpool),
|
||||
response_buf_(mcpool),
|
||||
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),
|
||||
request_state_(INITIAL), response_state_(INITIAL),
|
||||
dispatch_state_(DISPATCH_NONE), upgraded_(false), chunked_request_(false),
|
||||
chunked_response_(false), expect_final_response_(false),
|
||||
request_state_(INITIAL),
|
||||
response_state_(INITIAL),
|
||||
dispatch_state_(DISPATCH_NONE),
|
||||
upgraded_(false),
|
||||
chunked_request_(false),
|
||||
chunked_response_(false),
|
||||
expect_final_response_(false),
|
||||
request_pending_(false) {
|
||||
|
||||
auto &timeoutconf = get_config()->http2.timeout;
|
||||
|
|
|
@ -52,7 +52,9 @@ struct BlockedLink;
|
|||
class FieldStore {
|
||||
public:
|
||||
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) {
|
||||
http2::init_hdidx(hdidx_);
|
||||
headers_.reserve(headers_initial_capacity);
|
||||
|
@ -124,10 +126,17 @@ private:
|
|||
|
||||
struct Request {
|
||||
Request()
|
||||
: fs(16), recv_body_length(0), unconsumed_body_length(0), 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) {}
|
||||
: fs(16),
|
||||
recv_body_length(0),
|
||||
unconsumed_body_length(0),
|
||||
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) {
|
||||
assert(unconsumed_body_length >= len);
|
||||
|
@ -173,8 +182,13 @@ struct Request {
|
|||
|
||||
struct Response {
|
||||
Response()
|
||||
: fs(32), recv_body_length(0), unconsumed_body_length(0), http_status(0),
|
||||
http_major(1), http_minor(1), connection_close(false) {}
|
||||
: fs(32),
|
||||
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) {
|
||||
assert(unconsumed_body_length >= len);
|
||||
|
|
|
@ -46,8 +46,11 @@ namespace shrpx {
|
|||
|
||||
Http2DownstreamConnection::Http2DownstreamConnection(
|
||||
DownstreamConnectionPool *dconn_pool, Http2Session *http2session)
|
||||
: DownstreamConnection(dconn_pool), dlnext(nullptr), dlprev(nullptr),
|
||||
http2session_(http2session), sd_(nullptr) {}
|
||||
: DownstreamConnection(dconn_pool),
|
||||
dlnext(nullptr),
|
||||
dlprev(nullptr),
|
||||
http2session_(http2session),
|
||||
sd_(nullptr) {}
|
||||
|
||||
Http2DownstreamConnection::~Http2DownstreamConnection() {
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
|
|
|
@ -150,10 +150,18 @@ Http2Session::Http2Session(struct ev_loop *loop, SSL_CTX *ssl_ctx,
|
|||
get_config()->conn.downstream.timeout.read, {}, {}, writecb, readcb,
|
||||
timeoutcb, this, get_config()->tls.dyn_rec.warmup_threshold,
|
||||
get_config()->tls.dyn_rec.idle_timeout),
|
||||
worker_(worker), connect_blocker_(connect_blocker), ssl_ctx_(ssl_ctx),
|
||||
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) {
|
||||
worker_(worker),
|
||||
connect_blocker_(connect_blocker),
|
||||
ssl_ctx_(ssl_ctx),
|
||||
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;
|
||||
on_read_ = on_write_ = &Http2Session::noop;
|
||||
|
|
|
@ -826,7 +826,9 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
|
|||
? get_config()->conn.downstream.connections_per_frontend
|
||||
: 0,
|
||||
!get_config()->http2_proxy),
|
||||
handler_(handler), session_(nullptr), shutdown_handled_(false) {
|
||||
handler_(handler),
|
||||
session_(nullptr),
|
||||
shutdown_handled_(false) {
|
||||
|
||||
int rv;
|
||||
|
||||
|
|
|
@ -118,7 +118,10 @@ HttpDownstreamConnection::HttpDownstreamConnection(
|
|||
get_config()->conn.downstream.timeout.read, {}, {}, connectcb,
|
||||
readcb, timeoutcb, this, get_config()->tls.dyn_rec.warmup_threshold,
|
||||
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) {}
|
||||
|
||||
HttpDownstreamConnection::~HttpDownstreamConnection() {}
|
||||
|
|
|
@ -49,7 +49,8 @@ using namespace nghttp2;
|
|||
namespace shrpx {
|
||||
|
||||
HttpsUpstream::HttpsUpstream(ClientHandler *handler)
|
||||
: handler_(handler), current_header_length_(0),
|
||||
: handler_(handler),
|
||||
current_header_length_(0),
|
||||
ioctrl_(handler->get_rlimit()) {
|
||||
http_parser_init(&htp_, HTTP_REQUEST);
|
||||
htp_.data = this;
|
||||
|
|
|
@ -94,7 +94,10 @@ MemcachedConnection::MemcachedConnection(const Address *addr,
|
|||
struct ev_loop *loop)
|
||||
: conn_(loop, -1, nullptr, nullptr, write_timeout, read_timeout, {}, {},
|
||||
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(); }
|
||||
|
||||
|
|
|
@ -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,
|
||||
Connection *conn)
|
||||
: w_(w), loop_(loop), conn_(conn), rate_(rate), burst_(burst),
|
||||
avail_(burst), startw_req_(false) {
|
||||
: w_(w),
|
||||
loop_(loop),
|
||||
conn_(conn),
|
||||
rate_(rate),
|
||||
burst_(burst),
|
||||
avail_(burst),
|
||||
startw_req_(false) {
|
||||
ev_timer_init(&t_, regencb, 0., 1.);
|
||||
t_.data = this;
|
||||
if (rate_ > 0) {
|
||||
|
|
|
@ -504,7 +504,8 @@ SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler)
|
|||
? get_config()->conn.downstream.connections_per_frontend
|
||||
: 0,
|
||||
!get_config()->http2_proxy),
|
||||
handler_(handler), session_(nullptr) {
|
||||
handler_(handler),
|
||||
session_(nullptr) {
|
||||
spdylay_session_callbacks callbacks{};
|
||||
callbacks.send_callback = send_callback;
|
||||
callbacks.recv_callback = recv_callback;
|
||||
|
|
|
@ -72,8 +72,11 @@ Worker::Worker(struct ev_loop *loop, SSL_CTX *sv_ssl_ctx, SSL_CTX *cl_ssl_ctx,
|
|||
: randgen_(rd()),
|
||||
dconn_pool_(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),
|
||||
sv_ssl_ctx_(sv_ssl_ctx), cl_ssl_ctx_(cl_ssl_ctx), cert_tree_(cert_tree),
|
||||
dgrps_(get_config()->conn.downstream.addr_groups.size()),
|
||||
loop_(loop),
|
||||
sv_ssl_ctx_(sv_ssl_ctx),
|
||||
cl_ssl_ctx_(cl_ssl_ctx),
|
||||
cert_tree_(cert_tree),
|
||||
ticket_keys_(ticket_keys),
|
||||
connect_blocker_(make_unique<ConnectBlocker>(loop_)),
|
||||
graceful_shutdown_(false) {
|
||||
|
|
Loading…
Reference in New Issue