From 48bb1ebe018002ee8b7f846bae5eefbb7303fafd Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 17 Aug 2021 19:16:11 +0900 Subject: [PATCH] nghttpx: Add configuration to enable ngtcp2 logging (no cmd-line opt yet) --- src/shrpx_config.h | 3 +++ src/shrpx_http3_upstream.cc | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/shrpx_config.h b/src/shrpx_config.h index 74fd42fb..291e25e6 100644 --- a/src/shrpx_config.h +++ b/src/shrpx_config.h @@ -711,6 +711,9 @@ struct QUICConfig { struct { ev_tstamp idle; } timeout; + struct { + bool log; + } debug; }; // custom error page diff --git a/src/shrpx_http3_upstream.cc b/src/shrpx_http3_upstream.cc index 5c05fe0d..e4b945ae 100644 --- a/src/shrpx_http3_upstream.cc +++ b/src/shrpx_http3_upstream.cc @@ -451,9 +451,14 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr, return -1; } + auto config = get_config(); + auto &quicconf = config->quic; + ngtcp2_settings settings; ngtcp2_settings_default(&settings); - settings.log_printf = log_printf; + if (quicconf.debug.log) { + settings.log_printf = log_printf; + } settings.initial_ts = quic_timestamp(); settings.cc_algo = NGTCP2_CC_ALGO_BBR; settings.max_window = 6_m; @@ -461,9 +466,6 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr, settings.max_udp_payload_size = SHRPX_MAX_UDP_PAYLOAD_SIZE; settings.rand_ctx.native_handle = &worker->get_randgen(); - auto config = get_config(); - auto &quicconf = config->quic; - ngtcp2_transport_params params; ngtcp2_transport_params_default(¶ms); params.initial_max_streams_bidi = 100;