From: Olivier Houchard Date: Mon, 24 Dec 2018 12:32:13 +0000 (+0100) Subject: BUG/MEDIUM: servers: Don't try to reuse connection if we switched server. X-Git-Tag: v2.0-dev1~318 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb3dac37a291047e4da17a67bc1d23cbf92df2aa;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: servers: Don't try to reuse connection if we switched server. In connect_server(), don't attempt to reuse the old connection if it's targetting a different server than the one we're supposed to access, or we will never be able to connect to a server if the first one we tried failed. This should be backported to 1.9. --- diff --git a/src/backend.c b/src/backend.c index 2407f8a32e..bc38c57104 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1129,7 +1129,7 @@ int connect_server(struct stream *s) srv_cs = objt_cs(s->si[1].end); if (srv_cs) { old_conn = srv_conn = cs_conn(srv_cs); - if (old_conn) { + if (old_conn && (!old_conn->target || old_conn->target == s->target)) { old_conn->flags &= ~(CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH); srv_cs->flags &= ~(CS_FL_ERROR | CS_FL_EOS | CS_FL_REOS); reuse = 1;