From bb3dac37a291047e4da17a67bc1d23cbf92df2aa Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Mon, 24 Dec 2018 13:32:13 +0100 Subject: [PATCH] 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. --- src/backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend.c b/src/backend.c index 2407f8a32..bc38c5710 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;