nghttpx: Fix frequent crash with --backend-http-proxy-uri

This commit is contained in:
Tatsuhiro Tsujikawa 2016-11-26 18:36:56 +09:00
parent e9ab75a386
commit 7451f2f212
1 changed files with 10 additions and 11 deletions

View File

@ -481,23 +481,22 @@ int Http2Session::initiate_connection() {
}
}
write_ = &Http2Session::connected;
on_write_ = &Http2Session::downstream_write;
on_read_ = &Http2Session::downstream_read;
// We have been already connected when no TLS and proxy is used.
if (state_ != CONNECTED) {
state_ = CONNECTING;
conn_.wlimit.startw();
conn_.wt.repeat = downstreamconf.timeout.connect;
ev_timer_again(conn_.loop, &conn_.wt);
} else {
conn_.rlimit.startw();
conn_.again_rt();
if (state_ == PROXY_CONNECTED) {
return connected();
}
write_ = &Http2Session::connected;
state_ = CONNECTING;
conn_.wlimit.startw();
conn_.wt.repeat = downstreamconf.timeout.connect;
ev_timer_again(conn_.loop, &conn_.wt);
return 0;
}