From daca43f0ddc885052dcbda187bd1c32818fec680 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 4 Nov 2017 15:46:08 +0900 Subject: [PATCH] nghttpx: Fix stalled backend connection on retry --- src/shrpx_http_downstream_connection.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/shrpx_http_downstream_connection.cc b/src/shrpx_http_downstream_connection.cc index 41af957f..54ee89af 100644 --- a/src/shrpx_http_downstream_connection.cc +++ b/src/shrpx_http_downstream_connection.cc @@ -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; }