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();
}
upstreamconf.initial_rtt = NGTCP2_DEFAULT_INITIAL_RTT;
upstreamconf.initial_rtt =
static_cast<ev_tstamp>(NGTCP2_DEFAULT_INITIAL_RTT) / NGTCP2_SECONDS;
}
auto &http3conf = config->http3;
@ -3404,10 +3405,7 @@ HTTP/3 and QUIC:
--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"(
<< util::duration_str(config->quic.upstream.initial_rtt) << R"(
--no-quic-bpf
Disable eBPF.
--frontend-http3-window-size=<SIZE>

View File

@ -4159,13 +4159,7 @@ int parse_config(Config *config, int optid, const StringRef &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);
return parse_duration(&config->quic.upstream.initial_rtt, opt, optarg);
#endif // ENABLE_HTTP3
return 0;

View File

@ -782,7 +782,7 @@ struct QUICConfig {
bool require_token;
std::array<uint8_t, SHRPX_QUIC_SERVER_IDLEN> server_id;
StringRef secret_file;
ngtcp2_duration initial_rtt;
ev_tstamp initial_rtt;
} upstream;
struct {
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_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.max_window = http3conf.upstream.max_connection_window_size;
settings.max_stream_window = http3conf.upstream.max_window_size;