From 274b3a22969bc594b673508bf09f981ae93479c2 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 11 Mar 2015 00:27:51 +0900 Subject: [PATCH] nghttpx: Reset connection check timer on successful write while not checking --- src/shrpx_http2_session.cc | 9 +++++++++ src/shrpx_http2_session.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index c83e4884..66b9595b 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -137,6 +137,7 @@ void writecb(struct ev_loop *loop, ev_io *w, int revents) { http2session->disconnect(http2session->should_hard_fail()); return; } + http2session->reset_connection_check_timer_if_not_checking(); } } // namespace @@ -1472,6 +1473,14 @@ void Http2Session::reset_connection_check_timer(ev_tstamp t) { ev_timer_again(conn_.loop, &connchk_timer_); } +void Http2Session::reset_connection_check_timer_if_not_checking() { + if (connection_check_state_ != CONNECTION_CHECK_NONE) { + return; + } + + reset_connection_check_timer(CONNCHK_TIMEOUT); +} + void Http2Session::connection_alive() { reset_connection_check_timer(CONNCHK_TIMEOUT); diff --git a/src/shrpx_http2_session.h b/src/shrpx_http2_session.h index 21b1c776..10d056a6 100644 --- a/src/shrpx_http2_session.h +++ b/src/shrpx_http2_session.h @@ -135,6 +135,7 @@ public: // require connection checking. If connection checking is already // enabled, this timeout is for PING ACK timeout. void reset_connection_check_timer(ev_tstamp t); + void reset_connection_check_timer_if_not_checking(); // Signals that connection is alive. Internally // reset_connection_check_timer() is called. void connection_alive();