diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index fdac7835..797ca000 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -112,6 +112,8 @@ void timeoutcb(struct ev_loop *loop, ev_timer *w, int revents) { SSLOG(INFO, http2session) << "Timeout"; } + http2session->on_timeout(); + delete http2session; } } // namespace @@ -2177,4 +2179,18 @@ void Http2Session::exclude_from_scheduling() { DefaultMemchunks *Http2Session::get_request_buf() { return &wb_; } +void Http2Session::on_timeout() { + switch (state_) { + case PROXY_CONNECTING: { + auto worker_blocker = worker_->get_connect_blocker(); + worker_blocker->on_failure(); + break; + } + case CONNECTING: { + downstream_failure(addr_); + break; + } + } +} + } // namespace shrpx diff --git a/src/shrpx_http2_session.h b/src/shrpx_http2_session.h index 239ccd45..22ee392b 100644 --- a/src/shrpx_http2_session.h +++ b/src/shrpx_http2_session.h @@ -197,6 +197,8 @@ public: DefaultMemchunks *get_request_buf(); + void on_timeout(); + enum { // Disconnected DISCONNECTED,