From 649c69fa9e4fb1f3b0176307d0fb3d136e780e5c Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 4 Sep 2021 19:04:22 +0900 Subject: [PATCH] nghttpx: Do not send CONNECTION_CLOSE on idle timeout --- src/shrpx_http3_upstream.cc | 9 ++++++--- src/shrpx_http3_upstream.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/shrpx_http3_upstream.cc b/src/shrpx_http3_upstream.cc index 06c82d05..cd3c4513 100644 --- a/src/shrpx_http3_upstream.cc +++ b/src/shrpx_http3_upstream.cc @@ -51,7 +51,7 @@ void idle_timeoutcb(struct ev_loop *loop, ev_timer *w, int revents) { ULOG(INFO, upstream) << "QUIC idle timeout"; } - // TODO Implement draining period. + upstream->idle_close(); auto handler = upstream->get_client_handler(); @@ -116,7 +116,8 @@ Http3Upstream::Http3Upstream(ClientHandler *handler) tls_alert_{0}, httpconn_{nullptr}, downstream_queue_{downstream_queue_size(handler->get_worker()), - !get_config()->http2_proxy} { + !get_config()->http2_proxy}, + idle_close_{false} { ev_timer_init(&timer_, timeoutcb, 0., 0.); timer_.data = this; @@ -1276,7 +1277,7 @@ void Http3Upstream::on_handler_delete() { // If this is not idle close, send APPLICATION_CLOSE since this // might come before idle close. - if (!ngtcp2_conn_is_in_closing_period(conn_) && + if (!idle_close_ && !ngtcp2_conn_is_in_closing_period(conn_) && !ngtcp2_conn_is_in_draining_period(conn_)) { ngtcp2_path_storage ps; ngtcp2_pkt_info pi; @@ -2498,4 +2499,6 @@ int Http3Upstream::submit_goaway() { return 0; } +void Http3Upstream::idle_close() { idle_close_ = true; } + } // namespace shrpx diff --git a/src/shrpx_http3_upstream.h b/src/shrpx_http3_upstream.h index c5ca2a27..c2675e4e 100644 --- a/src/shrpx_http3_upstream.h +++ b/src/shrpx_http3_upstream.h @@ -147,6 +147,7 @@ public: int check_shutdown(); int start_graceful_shutdown(); int submit_goaway(); + void idle_close(); private: ClientHandler *handler_; @@ -159,6 +160,7 @@ private: uint8_t tls_alert_; nghttp3_conn *httpconn_; DownstreamQueue downstream_queue_; + bool idle_close_; }; } // namespace shrpx