nghttpx: Store initial_rtt in ev_tstamp for consistency

This commit is contained in:
Tatsuhiro Tsujikawa 2021-10-10 17:34:58 +09:00
parent 69c4187100
commit fa7a916ef3
4 changed files with 7 additions and 14 deletions

View File

@ -1959,7 +1959,8 @@ void fill_default_config(Config *config) {
abort(); abort();
} }
upstreamconf.initial_rtt = NGTCP2_DEFAULT_INITIAL_RTT; upstreamconf.initial_rtt =
static_cast<ev_tstamp>(NGTCP2_DEFAULT_INITIAL_RTT) / NGTCP2_SECONDS;
} }
auto &http3conf = config->http3; auto &http3conf = config->http3;
@ -3404,10 +3405,7 @@ HTTP/3 and QUIC:
--frontend-quic-initial-rtt=<DURATION> --frontend-quic-initial-rtt=<DURATION>
Specify the initial RTT of the frontend QUIC connection. Specify the initial RTT of the frontend QUIC connection.
Default: )" Default: )"
<< util::duration_str( << util::duration_str(config->quic.upstream.initial_rtt) << R"(
static_cast<double>(config->quic.upstream.initial_rtt) /
NGTCP2_SECONDS)
<< R"(
--no-quic-bpf --no-quic-bpf
Disable eBPF. Disable eBPF.
--frontend-http3-window-size=<SIZE> --frontend-http3-window-size=<SIZE>

View File

@ -4159,13 +4159,7 @@ int parse_config(Config *config, int optid, const StringRef &opt,
optarg); optarg);
case SHRPX_OPTID_FRONTEND_QUIC_INITIAL_RTT: { case SHRPX_OPTID_FRONTEND_QUIC_INITIAL_RTT: {
#ifdef ENABLE_HTTP3 #ifdef ENABLE_HTTP3
ev_tstamp d; return parse_duration(&config->quic.upstream.initial_rtt, opt, optarg);
if (parse_duration(&d, opt, optarg) != 0) {
return -1;
}
config->quic.upstream.initial_rtt =
static_cast<ngtcp2_duration>(d * NGTCP2_SECONDS);
#endif // ENABLE_HTTP3 #endif // ENABLE_HTTP3
return 0; return 0;

View File

@ -782,7 +782,7 @@ struct QUICConfig {
bool require_token; bool require_token;
std::array<uint8_t, SHRPX_QUIC_SERVER_IDLEN> server_id; std::array<uint8_t, SHRPX_QUIC_SERVER_IDLEN> server_id;
StringRef secret_file; StringRef secret_file;
ngtcp2_duration initial_rtt; ev_tstamp initial_rtt;
} upstream; } upstream;
struct { struct {
StringRef prog_file; StringRef prog_file;

View File

@ -592,7 +592,8 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr,
} }
settings.initial_ts = quic_timestamp(); settings.initial_ts = quic_timestamp();
settings.initial_rtt = quicconf.upstream.initial_rtt; settings.initial_rtt = static_cast<ngtcp2_tstamp>(
quicconf.upstream.initial_rtt * NGTCP2_SECONDS);
settings.cc_algo = quicconf.upstream.congestion_controller; settings.cc_algo = quicconf.upstream.congestion_controller;
settings.max_window = http3conf.upstream.max_connection_window_size; settings.max_window = http3conf.upstream.max_connection_window_size;
settings.max_stream_window = http3conf.upstream.max_window_size; settings.max_stream_window = http3conf.upstream.max_window_size;