nghttpx: Fix stalled backend connection on retry

This commit is contained in:
Tatsuhiro Tsujikawa 2017-11-04 15:46:08 +09:00
parent 16bc11e670
commit daca43f0dd
1 changed files with 5 additions and 2 deletions

View File

@ -92,7 +92,8 @@ void connect_timeoutcb(struct ev_loop *loop, ev_timer *w, int revents) {
int rv;
auto ndconn = handler->get_downstream_connection(rv, downstream);
if (ndconn) {
if (downstream->attach_downstream_connection(std::move(ndconn)) == 0) {
if (downstream->attach_downstream_connection(std::move(ndconn)) == 0 &&
downstream->push_request_headers() == 0) {
return;
}
}
@ -142,7 +143,8 @@ void backend_retry(Downstream *downstream) {
int rv;
auto ndconn = handler->get_downstream_connection(rv, downstream);
if (ndconn) {
if (downstream->attach_downstream_connection(std::move(ndconn)) == 0) {
if (downstream->attach_downstream_connection(std::move(ndconn)) == 0 &&
downstream->push_request_headers() == 0) {
return;
}
}
@ -483,6 +485,7 @@ int HttpDownstreamConnection::initiate_connection() {
int HttpDownstreamConnection::push_request_headers() {
if (downstream_->get_request_header_sent()) {
signal_write();
return 0;
}