nghttpx: Make backend fail if connect attempt is timed out

This commit is contained in:
Tatsuhiro Tsujikawa 2016-05-24 21:59:24 +09:00
parent f2a1fadda9
commit 45f7c17932
2 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -197,6 +197,8 @@ public:
DefaultMemchunks *get_request_buf();
void on_timeout();
enum {
// Disconnected
DISCONNECTED,