nghttpx: Do not send CONNECTION_CLOSE on idle timeout

This commit is contained in:
Tatsuhiro Tsujikawa 2021-09-04 19:04:22 +09:00
parent 9fd0b87925
commit 649c69fa9e
2 changed files with 8 additions and 3 deletions

View File

@ -51,7 +51,7 @@ void idle_timeoutcb(struct ev_loop *loop, ev_timer *w, int revents) {
ULOG(INFO, upstream) << "QUIC idle timeout"; ULOG(INFO, upstream) << "QUIC idle timeout";
} }
// TODO Implement draining period. upstream->idle_close();
auto handler = upstream->get_client_handler(); auto handler = upstream->get_client_handler();
@ -116,7 +116,8 @@ Http3Upstream::Http3Upstream(ClientHandler *handler)
tls_alert_{0}, tls_alert_{0},
httpconn_{nullptr}, httpconn_{nullptr},
downstream_queue_{downstream_queue_size(handler->get_worker()), 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.); ev_timer_init(&timer_, timeoutcb, 0., 0.);
timer_.data = this; timer_.data = this;
@ -1276,7 +1277,7 @@ void Http3Upstream::on_handler_delete() {
// If this is not idle close, send APPLICATION_CLOSE since this // If this is not idle close, send APPLICATION_CLOSE since this
// might come before idle close. // 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_conn_is_in_draining_period(conn_)) {
ngtcp2_path_storage ps; ngtcp2_path_storage ps;
ngtcp2_pkt_info pi; ngtcp2_pkt_info pi;
@ -2498,4 +2499,6 @@ int Http3Upstream::submit_goaway() {
return 0; return 0;
} }
void Http3Upstream::idle_close() { idle_close_ = true; }
} // namespace shrpx } // namespace shrpx

View File

@ -147,6 +147,7 @@ public:
int check_shutdown(); int check_shutdown();
int start_graceful_shutdown(); int start_graceful_shutdown();
int submit_goaway(); int submit_goaway();
void idle_close();
private: private:
ClientHandler *handler_; ClientHandler *handler_;
@ -159,6 +160,7 @@ private:
uint8_t tls_alert_; uint8_t tls_alert_;
nghttp3_conn *httpconn_; nghttp3_conn *httpconn_;
DownstreamQueue downstream_queue_; DownstreamQueue downstream_queue_;
bool idle_close_;
}; };
} // namespace shrpx } // namespace shrpx