nghttpx: Add --quic-idle-timeout option

This commit is contained in:
Tatsuhiro Tsujikawa 2021-08-27 18:44:33 +09:00
parent c1bcf0f11a
commit 6931cb9d65
4 changed files with 22 additions and 0 deletions

View File

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

View File

@ -2883,6 +2883,10 @@ Scripting:
#ifdef ENABLE_HTTP3
out << R"(
QUIC:
--quic-idle-timeout=<DURATION>
Specify an idle timeout for QUIC connection.
Default: )"
<< config->quic.timeout.idle << R"(
--bpf-program-file=<PATH>
Specify a path to eBPF program file reuseport_kern.o to
direct an incoming QUIC UDP datagram to a correct
@ -3598,6 +3602,7 @@ int main(int argc, char **argv) {
{SHRPX_OPT_HTTP2_ALTSVC.c_str(), required_argument, &flag, 171},
{SHRPX_OPT_FRONTEND_HTTP3_READ_TIMEOUT.c_str(), required_argument,
&flag, 172},
{SHRPX_OPT_QUIC_IDLE_TIMEOUT.c_str(), required_argument, &flag, 173},
{nullptr, 0, nullptr, 0}};
int option_index = 0;
@ -4418,6 +4423,10 @@ int main(int argc, char **argv) {
cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_HTTP3_READ_TIMEOUT,
StringRef{optarg});
break;
case 173:
// --quic-idle-timeout
cmdcfgs.emplace_back(SHRPX_OPT_QUIC_IDLE_TIMEOUT, StringRef{optarg});
break;
default:
break;
}

View File

@ -2092,6 +2092,9 @@ int option_lookup_token(const char *name, size_t namelen) {
if (util::strieq_l("dns-cache-timeou", name, 16)) {
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)) {
return SHRPX_OPTID_WORKER_READ_BURST;
}
@ -3879,6 +3882,12 @@ int parse_config(Config *config, int optid, const StringRef &opt,
case SHRPX_OPTID_FRONTEND_HTTP3_READ_TIMEOUT:
return parse_duration(&config->conn.upstream.timeout.http3_read, opt,
optarg);
case SHRPX_OPTID_QUIC_IDLE_TIMEOUT:
#ifdef ENABLE_HTTP3
return parse_duration(&config->quic.timeout.idle, opt, optarg);
#else // !ENABLE_HTTP3
return 0;
#endif // !ENABLE_HTTP3
case SHRPX_OPTID_CONF:
LOG(WARN) << "conf: ignored";

View File

@ -369,6 +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_FRONTEND_HTTP3_READ_TIMEOUT =
StringRef::from_lit("frontend-http3-read-timeout");
constexpr auto SHRPX_OPT_QUIC_IDLE_TIMEOUT =
StringRef::from_lit("quic-idle-timeout");
constexpr size_t SHRPX_OBFUSCATED_NODE_LENGTH = 8;
@ -1207,6 +1209,7 @@ enum {
SHRPX_OPTID_PRIVATE_KEY_FILE,
SHRPX_OPTID_PRIVATE_KEY_PASSWD_FILE,
SHRPX_OPTID_PSK_SECRETS,
SHRPX_OPTID_QUIC_IDLE_TIMEOUT,
SHRPX_OPTID_READ_BURST,
SHRPX_OPTID_READ_RATE,
SHRPX_OPTID_REDIRECT_HTTPS_PORT,