nghttpx: Try next HTTP/1 backend address when connection cannot be made
This commit is contained in:
parent
b6708a4b87
commit
a16daf109b
|
@ -102,6 +102,17 @@ void connectcb(struct ev_loop *loop, ev_io *w, int revents) {
|
||||||
auto upstream = downstream->get_upstream();
|
auto upstream = downstream->get_upstream();
|
||||||
auto handler = upstream->get_client_handler();
|
auto handler = upstream->get_client_handler();
|
||||||
if (dconn->connected() != 0) {
|
if (dconn->connected() != 0) {
|
||||||
|
downstream->pop_downstream_connection();
|
||||||
|
|
||||||
|
auto ndconn = handler->get_downstream_connection(downstream);
|
||||||
|
if (ndconn) {
|
||||||
|
if (downstream->attach_downstream_connection(std::move(ndconn)) == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
downstream->set_request_state(Downstream::CONNECT_FAIL);
|
||||||
|
|
||||||
if (upstream->on_downstream_abort_request(downstream, 503) != 0) {
|
if (upstream->on_downstream_abort_request(downstream, 503) != 0) {
|
||||||
delete handler;
|
delete handler;
|
||||||
}
|
}
|
||||||
|
@ -1056,8 +1067,6 @@ int HttpDownstreamConnection::connected() {
|
||||||
|
|
||||||
downstream_failure(addr_);
|
downstream_failure(addr_);
|
||||||
|
|
||||||
downstream_->set_request_state(Downstream::CONNECT_FAIL);
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue