]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: servers: Don't try to reuse connection if we switched server.
authorOlivier Houchard <ohouchard@haproxy.com>
Mon, 24 Dec 2018 12:32:13 +0000 (13:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 24 Dec 2018 12:45:43 +0000 (13:45 +0100)
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

index 2407f8a32ec37d24069a12c7ff55d2ae486dfc11..bc38c571040db42f02a2d89e403de93c39bd3622 100644 (file)
@@ -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;