mirror of
https://gitee.com/openharmony/third_party_nghttp2
synced 2024-11-23 07:50:02 +00:00
nghttpx: Add --frontend-quic-initial-rtt option
This commit is contained in:
parent
07128719c4
commit
69c4187100
@ -197,6 +197,7 @@ OPTIONS = [
|
||||
"rlimit-memlock",
|
||||
"max-worker-processes",
|
||||
"worker-process-grace-shutdown-period",
|
||||
"frontend-quic-initial-rtt",
|
||||
]
|
||||
|
||||
LOGVARS = [
|
||||
|
16
src/shrpx.cc
16
src/shrpx.cc
@ -1958,6 +1958,8 @@ void fill_default_config(Config *config) {
|
||||
assert(0);
|
||||
abort();
|
||||
}
|
||||
|
||||
upstreamconf.initial_rtt = NGTCP2_DEFAULT_INITIAL_RTT;
|
||||
}
|
||||
|
||||
auto &http3conf = config->http3;
|
||||
@ -3399,6 +3401,13 @@ HTTP/3 and QUIC:
|
||||
(which is 8 bytes long). If this option is omitted, a
|
||||
random server ID is generated on startup and
|
||||
configuration reload.
|
||||
--frontend-quic-initial-rtt=<DURATION>
|
||||
Specify the initial RTT of the frontend QUIC connection.
|
||||
Default: )"
|
||||
<< util::duration_str(
|
||||
static_cast<double>(config->quic.upstream.initial_rtt) /
|
||||
NGTCP2_SECONDS)
|
||||
<< R"(
|
||||
--no-quic-bpf
|
||||
Disable eBPF.
|
||||
--frontend-http3-window-size=<SIZE>
|
||||
@ -4218,6 +4227,8 @@ int main(int argc, char **argv) {
|
||||
{SHRPX_OPT_MAX_WORKER_PROCESSES.c_str(), required_argument, &flag, 188},
|
||||
{SHRPX_OPT_WORKER_PROCESS_GRACE_SHUTDOWN_PERIOD.c_str(),
|
||||
required_argument, &flag, 189},
|
||||
{SHRPX_OPT_FRONTEND_QUIC_INITIAL_RTT.c_str(), required_argument, &flag,
|
||||
190},
|
||||
{nullptr, 0, nullptr, 0}};
|
||||
|
||||
int option_index = 0;
|
||||
@ -5118,6 +5129,11 @@ int main(int argc, char **argv) {
|
||||
cmdcfgs.emplace_back(SHRPX_OPT_WORKER_PROCESS_GRACE_SHUTDOWN_PERIOD,
|
||||
StringRef{optarg});
|
||||
break;
|
||||
case 190:
|
||||
// --frontend-quic-initial-rtt
|
||||
cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_QUIC_INITIAL_RTT,
|
||||
StringRef{optarg});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -2440,6 +2440,11 @@ int option_lookup_token(const char *name, size_t namelen) {
|
||||
return SHRPX_OPTID_MAX_REQUEST_HEADER_FIELDS;
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
if (util::strieq_l("frontend-quic-initial-rt", name, 24)) {
|
||||
return SHRPX_OPTID_FRONTEND_QUIC_INITIAL_RTT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 26:
|
||||
@ -4152,6 +4157,19 @@ int parse_config(Config *config, int optid, const StringRef &opt,
|
||||
case SHRPX_OPTID_WORKER_PROCESS_GRACE_SHUTDOWN_PERIOD:
|
||||
return parse_duration(&config->worker_process_grace_shutdown_period, opt,
|
||||
optarg);
|
||||
case SHRPX_OPTID_FRONTEND_QUIC_INITIAL_RTT: {
|
||||
#ifdef ENABLE_HTTP3
|
||||
ev_tstamp d;
|
||||
if (parse_duration(&d, opt, optarg) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
config->quic.upstream.initial_rtt =
|
||||
static_cast<ngtcp2_duration>(d * NGTCP2_SECONDS);
|
||||
#endif // ENABLE_HTTP3
|
||||
|
||||
return 0;
|
||||
}
|
||||
case SHRPX_OPTID_CONF:
|
||||
LOG(WARN) << "conf: ignored";
|
||||
|
||||
|
@ -400,6 +400,8 @@ constexpr auto SHRPX_OPT_MAX_WORKER_PROCESSES =
|
||||
StringRef::from_lit("max-worker-processes");
|
||||
constexpr auto SHRPX_OPT_WORKER_PROCESS_GRACE_SHUTDOWN_PERIOD =
|
||||
StringRef::from_lit("worker-process-grace-shutdown-period");
|
||||
constexpr auto SHRPX_OPT_FRONTEND_QUIC_INITIAL_RTT =
|
||||
StringRef::from_lit("frontend-quic-initial-rtt");
|
||||
|
||||
constexpr size_t SHRPX_OBFUSCATED_NODE_LENGTH = 8;
|
||||
|
||||
@ -780,6 +782,7 @@ struct QUICConfig {
|
||||
bool require_token;
|
||||
std::array<uint8_t, SHRPX_QUIC_SERVER_IDLEN> server_id;
|
||||
StringRef secret_file;
|
||||
ngtcp2_duration initial_rtt;
|
||||
} upstream;
|
||||
struct {
|
||||
StringRef prog_file;
|
||||
@ -1242,6 +1245,7 @@ enum {
|
||||
SHRPX_OPTID_FRONTEND_QUIC_DEBUG_LOG,
|
||||
SHRPX_OPTID_FRONTEND_QUIC_EARLY_DATA,
|
||||
SHRPX_OPTID_FRONTEND_QUIC_IDLE_TIMEOUT,
|
||||
SHRPX_OPTID_FRONTEND_QUIC_INITIAL_RTT,
|
||||
SHRPX_OPTID_FRONTEND_QUIC_QLOG_DIR,
|
||||
SHRPX_OPTID_FRONTEND_QUIC_REQUIRE_TOKEN,
|
||||
SHRPX_OPTID_FRONTEND_QUIC_SECRET_FILE,
|
||||
|
@ -592,6 +592,7 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr,
|
||||
}
|
||||
|
||||
settings.initial_ts = quic_timestamp();
|
||||
settings.initial_rtt = quicconf.upstream.initial_rtt;
|
||||
settings.cc_algo = quicconf.upstream.congestion_controller;
|
||||
settings.max_window = http3conf.upstream.max_connection_window_size;
|
||||
settings.max_stream_window = http3conf.upstream.max_window_size;
|
||||
|
Loading…
Reference in New Issue
Block a user