diff --git a/src/shrpx.cc b/src/shrpx.cc index a36c168b..c252f61f 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -1959,7 +1959,8 @@ void fill_default_config(Config *config) { abort(); } - upstreamconf.initial_rtt = NGTCP2_DEFAULT_INITIAL_RTT; + upstreamconf.initial_rtt = + static_cast(NGTCP2_DEFAULT_INITIAL_RTT) / NGTCP2_SECONDS; } auto &http3conf = config->http3; @@ -3404,10 +3405,7 @@ HTTP/3 and QUIC: --frontend-quic-initial-rtt= Specify the initial RTT of the frontend QUIC connection. Default: )" - << util::duration_str( - static_cast(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= diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index 25576c70..90bdc1c2 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -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(d * NGTCP2_SECONDS); + return parse_duration(&config->quic.upstream.initial_rtt, opt, optarg); #endif // ENABLE_HTTP3 return 0; diff --git a/src/shrpx_config.h b/src/shrpx_config.h index 1b19d2f5..27b6a9ac 100644 --- a/src/shrpx_config.h +++ b/src/shrpx_config.h @@ -782,7 +782,7 @@ struct QUICConfig { bool require_token; std::array server_id; StringRef secret_file; - ngtcp2_duration initial_rtt; + ev_tstamp initial_rtt; } upstream; struct { StringRef prog_file; diff --git a/src/shrpx_http3_upstream.cc b/src/shrpx_http3_upstream.cc index f59d0fff..662c19ae 100644 --- a/src/shrpx_http3_upstream.cc +++ b/src/shrpx_http3_upstream.cc @@ -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( + 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;