From 9a3461e2b6c92b39e4ad2985f17255b24d458499 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 21 May 2016 13:48:13 +0900 Subject: [PATCH] nghttpx: Use ev_timer_start intead of ev_timer_again for settings_timer_ Since we only use it once, we don't have to use ev_timer_again, and stop timer manually. --- src/shrpx_http2_session.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index 6107276b..644e236e 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -90,7 +90,6 @@ void connchk_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) { namespace { void settings_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) { auto http2session = static_cast(w->data); - http2session->stop_settings_timer(); SSLOG(INFO, http2session) << "SETTINGS timeout"; downstream_failure(http2session->get_addr()); @@ -203,7 +202,7 @@ Http2Session::Http2Session(struct ev_loop *loop, SSL_CTX *ssl_ctx, // SETTINGS ACK timeout is 10 seconds for now. We will resuse this // many times, so use repeat timeout value. - ev_timer_init(&settings_timer_, settings_timeout_cb, 0., 10.); + ev_timer_init(&settings_timer_, settings_timeout_cb, 0., 0.); settings_timer_.data = this; @@ -756,7 +755,8 @@ int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, } // namespace void Http2Session::start_settings_timer() { - ev_timer_again(conn_.loop, &settings_timer_); + ev_timer_set(&settings_timer_, 10., 0.); + ev_timer_start(conn_.loop, &settings_timer_); } void Http2Session::stop_settings_timer() {