]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: servers: Kill priv_conns.
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 2 Jan 2020 17:10:17 +0000 (18:10 +0100)
committerOlivier Houchard <cognet@ci0.org>
Wed, 11 Mar 2020 18:20:01 +0000 (19:20 +0100)
Remove the list of private connections from server, it has been largely
unused, we only inserted connections in it, but we would never actually
use it.

include/types/server.h
src/cfgparse.c
src/haproxy.c
src/hlua.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c

index 598dfe6d8f01d8ae64e471ed49835c74d02acb05..099b1d8a87a0764320448c2fe31ecfad5d1e0509 100644 (file)
@@ -221,7 +221,6 @@ struct server {
 
        struct eb_root pendconns;               /* pending connections */
        struct list actconns;                   /* active connections */
-       struct list *priv_conns;                /* private idle connections attached to stream interfaces */
        struct list *idle_conns;                /* sharable idle connections attached or not to a stream interface */
        struct list *safe_conns;                /* safe idle connections attached to stream interfaces, shared */
        struct mt_list *idle_orphan_conns;         /* Orphan connections idling */
index cd39904947ca2099f3b9a3d8abe9fc6b34dc11c1..53ef7069e8fcb6e407fee33f255546f28dad78f7 100644 (file)
@@ -3613,14 +3613,12 @@ out_uri_auth_compat:
                for (newsrv = curproxy->srv; newsrv; newsrv = newsrv->next) {
                        int i;
 
-                       newsrv->priv_conns = calloc(global.nbthread, sizeof(*newsrv->priv_conns));
                        newsrv->idle_conns = calloc(global.nbthread, sizeof(*newsrv->idle_conns));
                        newsrv->safe_conns = calloc(global.nbthread, sizeof(*newsrv->safe_conns));
 
-                       if (!newsrv->priv_conns || !newsrv->idle_conns || !newsrv->safe_conns) {
+                       if (!newsrv->idle_conns || !newsrv->safe_conns) {
                                free(newsrv->safe_conns); newsrv->safe_conns = NULL;
                                free(newsrv->idle_conns); newsrv->idle_conns = NULL;
-                               free(newsrv->priv_conns); newsrv->priv_conns = NULL;
                                ha_alert("parsing [%s:%d] : failed to allocate idle connections for server '%s'.\n",
                                         newsrv->conf.file, newsrv->conf.line, newsrv->id);
                                cfgerr++;
@@ -3628,7 +3626,6 @@ out_uri_auth_compat:
                        }
 
                        for (i = 0; i < global.nbthread; i++) {
-                               LIST_INIT(&newsrv->priv_conns[i]);
                                LIST_INIT(&newsrv->idle_conns[i]);
                                LIST_INIT(&newsrv->safe_conns[i]);
                        }
index 6a584dc7e0b8541ee4026be2d9c149c71585f409..29c65f592226f9e2cd89f4b3b61aa8ff1131b51f 100644 (file)
@@ -2665,7 +2665,6 @@ void deinit(void)
                        free(s->hostname_dn);
                        free((char*)s->conf.file);
                        free(s->idle_conns);
-                       free(s->priv_conns);
                        free(s->safe_conns);
                        free(s->idle_orphan_conns);
                        free(s->curr_idle_thr);
index a8f48b39941cefaea2a560c89a976a67890c6651..34d39fb87b46b3edd149f33384e9ccc82bcd9d71 100644 (file)
@@ -8478,7 +8478,6 @@ void hlua_init(void)
        socket_tcp.obj_type = OBJ_TYPE_SERVER;
        LIST_INIT(&socket_tcp.actconns);
        socket_tcp.pendconns = EB_ROOT;
-       socket_tcp.priv_conns = NULL;
        socket_tcp.idle_conns = NULL;
        socket_tcp.safe_conns = NULL;
        socket_tcp.next_state = SRV_ST_RUNNING; /* early server setup */
@@ -8524,7 +8523,6 @@ void hlua_init(void)
        socket_ssl.obj_type = OBJ_TYPE_SERVER;
        LIST_INIT(&socket_ssl.actconns);
        socket_ssl.pendconns = EB_ROOT;
-       socket_ssl.priv_conns = NULL;
        socket_ssl.idle_conns = NULL;
        socket_ssl.safe_conns = NULL;
        socket_ssl.next_state = SRV_ST_RUNNING; /* early server setup */
index 7254add05c8289ad345fcfcf12da2f5d4aeeb0b7..02a5e2c1df98343e2184f4a717e25b76937b7766 100644 (file)
@@ -3503,9 +3503,7 @@ static void fcgi_detach(struct conn_stream *cs)
                        struct server *srv = objt_server(fconn->conn->target);
 
                        if (srv) {
-                               if (fconn->conn->flags & CO_FL_PRIVATE)
-                                       LIST_ADD(&srv->priv_conns[tid], &fconn->conn->list);
-                               else
+                               if (!(fconn->conn->flags & CO_FL_PRIVATE))
                                        LIST_ADD(&srv->idle_conns[tid], &fconn->conn->list);
                        }
                        TRACE_DEVEL("connection in idle server list", FCGI_EV_STRM_END, fconn->conn);
index 72606293f2d7ad78336bdda8d01d1a07ad986fc8..9edbaea8816d28a40514cdae0a544fab9268d8fe 100644 (file)
@@ -2425,12 +2425,12 @@ static void h1_detach(struct conn_stream *cs)
                        struct server *srv = objt_server(h1c->conn->target);
 
                        if (srv) {
-                               if (h1c->conn->flags & CO_FL_PRIVATE)
-                                       LIST_ADD(&srv->priv_conns[tid], &h1c->conn->list);
-                               else if (is_not_first)
-                                       LIST_ADD(&srv->safe_conns[tid], &h1c->conn->list);
-                               else
-                                       LIST_ADD(&srv->idle_conns[tid], &h1c->conn->list);
+                               if (!(h1c->conn->flags & CO_FL_PRIVATE)) {
+                                       if (is_not_first)
+                                               LIST_ADD(&srv->safe_conns[tid], &h1c->conn->list);
+                                       else
+                                               LIST_ADD(&srv->idle_conns[tid], &h1c->conn->list);
+                               }
                                TRACE_DEVEL("connection in idle server list", H1_EV_STRM_END, h1c->conn);
                        }
                }
index b8728970ba81ec20ffcd6af0c9da531ecc2859d9..013ef86f819af3fde3467653f1e302603d2488eb 100644 (file)
@@ -3901,9 +3901,7 @@ static void h2_detach(struct conn_stream *cs)
                                struct server *srv = objt_server(h2c->conn->target);
 
                                if (srv) {
-                                       if (h2c->conn->flags & CO_FL_PRIVATE)
-                                               LIST_ADD(&srv->priv_conns[tid], &h2c->conn->list);
-                                       else
+                                       if (!(h2c->conn->flags & CO_FL_PRIVATE))
                                                LIST_ADD(&srv->idle_conns[tid], &h2c->conn->list);
                                }