]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: Set new connection as private on reuse never
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Jul 2020 13:12:43 +0000 (15:12 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 15 Jul 2020 12:08:14 +0000 (14:08 +0200)
When a new connection is created, it may immediatly be set as private if
http-reuse never is configured for the backend. There is no reason to wait the
call to mux->detach() to do so.

src/backend.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c

index 3f6e7daa27d27af334ee6125358ab25f9c3c3bbe..e94fc1faf488ccb6780be4417fe3ad058e894f6c 100644 (file)
@@ -1401,6 +1401,9 @@ int connect_server(struct stream *s)
                if (srv_conn)
                        srv_conn->target = s->target;
                srv_cs = NULL;
+
+               if ((s->be->options & PR_O_REUSE_MASK) == PR_O_REUSE_NEVR)
+                       conn->flags |= CO_FL_PRIVATE;
        }
 
        if (srv_conn && srv && was_unused) {
index 76e93e4344d8d19708ad96c1c19ca4940a331f08..7cd56121957ebb80ba2509391cbbd250eebdd23e 100644 (file)
@@ -3540,9 +3540,6 @@ static void fcgi_detach(struct conn_stream *cs)
 
        if (!(fconn->conn->flags & (CO_FL_ERROR|CO_FL_SOCK_RD_SH|CO_FL_SOCK_WR_SH)) &&
            (fconn->flags & FCGI_CF_KEEP_CONN)) {
-               /* Never ever allow to reuse a connection from a non-reuse backend */
-               if ((fconn->proxy->options & PR_O_REUSE_MASK) == PR_O_REUSE_NEVR)
-                       fconn->conn->flags |= CO_FL_PRIVATE;
                if (fconn->conn->flags & CO_FL_PRIVATE) {
                        if (!fconn->conn->owner) {
                                fconn->conn->owner = sess;
index 80a7b7db51f78021e42c4554da41032283fe4eb7..6f594410d97b1397d6e483b20f6c29420011f498 100644 (file)
@@ -2453,10 +2453,6 @@ static void h1_detach(struct conn_stream *cs)
                        goto release;
                }
 
-               /* Never ever allow to reuse a connection from a non-reuse backend */
-               if ((h1c->px->options & PR_O_REUSE_MASK) == PR_O_REUSE_NEVR)
-                       h1c->conn->flags |= CO_FL_PRIVATE;
-
                if (!(h1c->conn->owner) && (h1c->conn->flags & CO_FL_PRIVATE)) {
                        h1c->conn->owner = sess;
                        if (!session_add_conn(sess, h1c->conn, h1c->conn->target)) {
index fc35c66a272fdf73cf2cf02b88d0edea356c52b9..22c67b02a711273cc0e03173c661687524e06840 100644 (file)
@@ -3942,9 +3942,6 @@ static void h2_detach(struct conn_stream *cs)
        if (h2c->flags & H2_CF_IS_BACK) {
                if (!(h2c->conn->flags &
                    (CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH))) {
-                       /* Never ever allow to reuse a connection from a non-reuse backend */
-                       if ((h2c->proxy->options & PR_O_REUSE_MASK) == PR_O_REUSE_NEVR)
-                               h2c->conn->flags |= CO_FL_PRIVATE;
                        if (h2c->conn->flags & CO_FL_PRIVATE) {
                                if (!h2c->conn->owner) {
                                        h2c->conn->owner = sess;