nghttpx: Rename --quic-idle-timeout to --frontend-quic-idle-timeout

This commit is contained in:
Tatsuhiro Tsujikawa 2021-08-27 19:03:06 +09:00
parent 0005efa508
commit c9b11e9fbf
5 changed files with 34 additions and 24 deletions

View File

@ -181,7 +181,7 @@ OPTIONS = [
"no-bpf", "no-bpf",
"http2-altsvc", "http2-altsvc",
"frontend-http3-read-timeout", "frontend-http3-read-timeout",
"quic-idle-timeout", "frontend-quic-idle-timeout",
] ]
LOGVARS = [ LOGVARS = [

View File

@ -1553,7 +1553,12 @@ void fill_default_config(Config *config) {
#ifdef ENABLE_HTTP3 #ifdef ENABLE_HTTP3
auto &quicconf = config->quic; auto &quicconf = config->quic;
{ {
quicconf.timeout.idle = 30_s; auto &upstreamconf = quicconf.upstream;
{
auto &timeoutconf = upstreamconf.timeout;
timeoutconf.idle = 30_s;
}
auto &bpfconf = quicconf.bpf; auto &bpfconf = quicconf.bpf;
bpfconf.prog_file = StringRef::from_lit(PKGLIBDIR "/reuseport_kern.o"); bpfconf.prog_file = StringRef::from_lit(PKGLIBDIR "/reuseport_kern.o");
@ -2883,10 +2888,10 @@ Scripting:
#ifdef ENABLE_HTTP3 #ifdef ENABLE_HTTP3
out << R"( out << R"(
QUIC: QUIC:
--quic-idle-timeout=<DURATION> --frontend-quic-idle-timeout=<DURATION>
Specify an idle timeout for QUIC connection. Specify an idle timeout for QUIC connection.
Default: )" Default: )"
<< config->quic.timeout.idle << R"( << config->quic.upstream.timeout.idle << R"(
--bpf-program-file=<PATH> --bpf-program-file=<PATH>
Specify a path to eBPF program file reuseport_kern.o to Specify a path to eBPF program file reuseport_kern.o to
direct an incoming QUIC UDP datagram to a correct direct an incoming QUIC UDP datagram to a correct
@ -3602,7 +3607,8 @@ int main(int argc, char **argv) {
{SHRPX_OPT_HTTP2_ALTSVC.c_str(), required_argument, &flag, 171}, {SHRPX_OPT_HTTP2_ALTSVC.c_str(), required_argument, &flag, 171},
{SHRPX_OPT_FRONTEND_HTTP3_READ_TIMEOUT.c_str(), required_argument, {SHRPX_OPT_FRONTEND_HTTP3_READ_TIMEOUT.c_str(), required_argument,
&flag, 172}, &flag, 172},
{SHRPX_OPT_QUIC_IDLE_TIMEOUT.c_str(), required_argument, &flag, 173}, {SHRPX_OPT_FRONTEND_QUIC_IDLE_TIMEOUT.c_str(), required_argument, &flag,
173},
{nullptr, 0, nullptr, 0}}; {nullptr, 0, nullptr, 0}};
int option_index = 0; int option_index = 0;
@ -4424,8 +4430,9 @@ int main(int argc, char **argv) {
StringRef{optarg}); StringRef{optarg});
break; break;
case 173: case 173:
// --quic-idle-timeout // --frontend-quic-idle-timeout
cmdcfgs.emplace_back(SHRPX_OPT_QUIC_IDLE_TIMEOUT, StringRef{optarg}); cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_QUIC_IDLE_TIMEOUT,
StringRef{optarg});
break; break;
default: default:
break; break;

View File

@ -2092,9 +2092,6 @@ int option_lookup_token(const char *name, size_t namelen) {
if (util::strieq_l("dns-cache-timeou", name, 16)) { if (util::strieq_l("dns-cache-timeou", name, 16)) {
return SHRPX_OPTID_DNS_CACHE_TIMEOUT; return SHRPX_OPTID_DNS_CACHE_TIMEOUT;
} }
if (util::strieq_l("quic-idle-timeou", name, 16)) {
return SHRPX_OPTID_QUIC_IDLE_TIMEOUT;
}
if (util::strieq_l("worker-read-burs", name, 16)) { if (util::strieq_l("worker-read-burs", name, 16)) {
return SHRPX_OPTID_WORKER_READ_BURST; return SHRPX_OPTID_WORKER_READ_BURST;
} }
@ -2366,6 +2363,9 @@ int option_lookup_token(const char *name, size_t namelen) {
if (util::strieq_l("backend-keep-alive-timeou", name, 25)) { if (util::strieq_l("backend-keep-alive-timeou", name, 25)) {
return SHRPX_OPTID_BACKEND_KEEP_ALIVE_TIMEOUT; return SHRPX_OPTID_BACKEND_KEEP_ALIVE_TIMEOUT;
} }
if (util::strieq_l("frontend-quic-idle-timeou", name, 25)) {
return SHRPX_OPTID_FRONTEND_QUIC_IDLE_TIMEOUT;
}
if (util::strieq_l("no-http2-cipher-black-lis", name, 25)) { if (util::strieq_l("no-http2-cipher-black-lis", name, 25)) {
return SHRPX_OPTID_NO_HTTP2_CIPHER_BLACK_LIST; return SHRPX_OPTID_NO_HTTP2_CIPHER_BLACK_LIST;
} }
@ -3886,9 +3886,9 @@ int parse_config(Config *config, int optid, const StringRef &opt,
#else // !ENABLE_HTTP3 #else // !ENABLE_HTTP3
return 0; return 0;
#endif // !ENABLE_HTTP3 #endif // !ENABLE_HTTP3
case SHRPX_OPTID_QUIC_IDLE_TIMEOUT: case SHRPX_OPTID_FRONTEND_QUIC_IDLE_TIMEOUT:
#ifdef ENABLE_HTTP3 #ifdef ENABLE_HTTP3
return parse_duration(&config->quic.timeout.idle, opt, optarg); return parse_duration(&config->quic.upstream.timeout.idle, opt, optarg);
#else // !ENABLE_HTTP3 #else // !ENABLE_HTTP3
return 0; return 0;
#endif // !ENABLE_HTTP3 #endif // !ENABLE_HTTP3

View File

@ -369,8 +369,8 @@ constexpr auto SHRPX_OPT_NO_BPF = StringRef::from_lit("no-bpf");
constexpr auto SHRPX_OPT_HTTP2_ALTSVC = StringRef::from_lit("http2-altsvc"); constexpr auto SHRPX_OPT_HTTP2_ALTSVC = StringRef::from_lit("http2-altsvc");
constexpr auto SHRPX_OPT_FRONTEND_HTTP3_READ_TIMEOUT = constexpr auto SHRPX_OPT_FRONTEND_HTTP3_READ_TIMEOUT =
StringRef::from_lit("frontend-http3-read-timeout"); StringRef::from_lit("frontend-http3-read-timeout");
constexpr auto SHRPX_OPT_QUIC_IDLE_TIMEOUT = constexpr auto SHRPX_OPT_FRONTEND_QUIC_IDLE_TIMEOUT =
StringRef::from_lit("quic-idle-timeout"); StringRef::from_lit("frontend-quic-idle-timeout");
constexpr size_t SHRPX_OBFUSCATED_NODE_LENGTH = 8; constexpr size_t SHRPX_OBFUSCATED_NODE_LENGTH = 8;
@ -728,11 +728,13 @@ struct TLSConfig {
#ifdef ENABLE_HTTP3 #ifdef ENABLE_HTTP3
struct QUICConfig { struct QUICConfig {
struct { struct {
ev_tstamp idle; struct {
} timeout; ev_tstamp idle;
struct { } timeout;
bool log; struct {
} debug; bool log;
} debug;
} upstream;
struct { struct {
StringRef prog_file; StringRef prog_file;
bool disabled; bool disabled;
@ -1169,6 +1171,7 @@ enum {
SHRPX_OPTID_FRONTEND_KEEP_ALIVE_TIMEOUT, SHRPX_OPTID_FRONTEND_KEEP_ALIVE_TIMEOUT,
SHRPX_OPTID_FRONTEND_MAX_REQUESTS, SHRPX_OPTID_FRONTEND_MAX_REQUESTS,
SHRPX_OPTID_FRONTEND_NO_TLS, SHRPX_OPTID_FRONTEND_NO_TLS,
SHRPX_OPTID_FRONTEND_QUIC_IDLE_TIMEOUT,
SHRPX_OPTID_FRONTEND_READ_TIMEOUT, SHRPX_OPTID_FRONTEND_READ_TIMEOUT,
SHRPX_OPTID_FRONTEND_WRITE_TIMEOUT, SHRPX_OPTID_FRONTEND_WRITE_TIMEOUT,
SHRPX_OPTID_HEADER_FIELD_BUFFER, SHRPX_OPTID_HEADER_FIELD_BUFFER,
@ -1209,7 +1212,6 @@ enum {
SHRPX_OPTID_PRIVATE_KEY_FILE, SHRPX_OPTID_PRIVATE_KEY_FILE,
SHRPX_OPTID_PRIVATE_KEY_PASSWD_FILE, SHRPX_OPTID_PRIVATE_KEY_PASSWD_FILE,
SHRPX_OPTID_PSK_SECRETS, SHRPX_OPTID_PSK_SECRETS,
SHRPX_OPTID_QUIC_IDLE_TIMEOUT,
SHRPX_OPTID_READ_BURST, SHRPX_OPTID_READ_BURST,
SHRPX_OPTID_READ_RATE, SHRPX_OPTID_READ_RATE,
SHRPX_OPTID_REDIRECT_HTTPS_PORT, SHRPX_OPTID_REDIRECT_HTTPS_PORT,

View File

@ -101,7 +101,8 @@ Http3Upstream::Http3Upstream(ClientHandler *handler)
auto config = get_config(); auto config = get_config();
auto &quicconf = config->quic; auto &quicconf = config->quic;
ev_timer_init(&idle_timer_, idle_timeoutcb, 0., quicconf.timeout.idle); ev_timer_init(&idle_timer_, idle_timeoutcb, 0.,
quicconf.upstream.timeout.idle);
idle_timer_.data = this; idle_timer_.data = this;
} }
@ -498,7 +499,7 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr,
ngtcp2_settings settings; ngtcp2_settings settings;
ngtcp2_settings_default(&settings); ngtcp2_settings_default(&settings);
if (quicconf.debug.log) { if (quicconf.upstream.debug.log) {
settings.log_printf = log_printf; settings.log_printf = log_printf;
} }
settings.initial_ts = quic_timestamp(); settings.initial_ts = quic_timestamp();
@ -516,8 +517,8 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr,
params.initial_max_data = 1_m; params.initial_max_data = 1_m;
params.initial_max_stream_data_bidi_remote = 256_k; params.initial_max_stream_data_bidi_remote = 256_k;
params.initial_max_stream_data_uni = 256_k; params.initial_max_stream_data_uni = 256_k;
params.max_idle_timeout = params.max_idle_timeout = static_cast<ngtcp2_tstamp>(
static_cast<ngtcp2_tstamp>(quicconf.timeout.idle * NGTCP2_SECONDS); quicconf.upstream.timeout.idle * NGTCP2_SECONDS);
if (odcid) { if (odcid) {
params.original_dcid = *odcid; params.original_dcid = *odcid;