]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connections: Make the "list" element a struct mt_list instead of list.
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 6 Mar 2020 17:12:03 +0000 (18:12 +0100)
committerOlivier Houchard <cognet@ci0.org>
Thu, 19 Mar 2020 21:07:33 +0000 (22:07 +0100)
Make the "list" element a struct mt_list, and explicitely use
list_from_mt_list to get a struct list * where it is used as such, so that
mt_list_for_each_entry will be usable with it.

include/proto/connection.h
include/proto/server.h
include/types/connection.h
src/backend.c
src/connection.c
src/mux_fcgi.c
src/mux_h2.c

index 2118d23329d6896335a82329cfddf52a266dc7af..65c99a1f3d488db28e73887634157c8bac6ae50d 100644 (file)
@@ -318,7 +318,7 @@ static inline void conn_init(struct connection *conn)
        conn->target = NULL;
        conn->destroy_cb = NULL;
        conn->proxy_netns = NULL;
-       LIST_INIT(&conn->list);
+       MT_LIST_INIT(&conn->list);
        LIST_INIT(&conn->session_list);
        conn->subs = NULL;
        conn->idle_time = 0;
index 06f553e02ca4983d7e7a5b485d62aa3e17b163da..ca794ab9c6cf12acbe26a524084c35a356301b21 100644 (file)
@@ -261,7 +261,7 @@ static inline int srv_add_to_idle_list(struct server *srv, struct connection *co
                        _HA_ATOMIC_SUB(&srv->curr_idle_conns, 1);
                        return 0;
                }
-               LIST_DEL_INIT(&conn->list);
+               MT_LIST_DEL(&conn->list);
                MT_LIST_ADDQ(is_safe ? &srv->safe_conns[tid] : &srv->idle_conns[tid],
                             (struct mt_list *)&conn->list);
                srv->curr_idle_thr[tid]++;
index 0136be94c74da6a9bb77b33b10cd3d59db6beae0..32a8590ebcc6dfdc61c7e64cc5659977e9ac95b4 100644 (file)
@@ -458,7 +458,7 @@ struct connection {
 
        /* second cache line */
        struct wait_event *subs; /* Task to wake when awaited events are ready */
-       struct list list;             /* attach point to various connection lists (idle, ...) */
+       struct mt_list list;          /* attach point to various connection lists (idle, ...) */
        struct list session_list;     /* List of attached connections to a session */
        union conn_handle handle;     /* connection handle at the socket layer */
        const struct netns_entry *proxy_netns;
index 2fc7a3f5c47af45d25ca94b75101ffbc122ee07a..b60e9000a244392deb9e15c1d1bdda3076495a5e 100644 (file)
@@ -1251,7 +1251,7 @@ int connect_server(struct stream *s)
                        _HA_ATOMIC_SUB(&srv->curr_idle_conns, 1);
                        __ha_barrier_atomic_store();
                        srv->curr_idle_thr[tid]--;
-                       LIST_ADDQ(&srv->available_conns[tid], &srv_conn->list);
+                       LIST_ADDQ(&srv->available_conns[tid], mt_list_to_list(&srv_conn->list));
                }
                else {
                        if (srv_conn->flags & CO_FL_SESS_IDLE) {
@@ -1269,8 +1269,7 @@ int connect_server(struct stream *s)
 
                        if (avail <= 1) {
                                /* No more streams available, remove it from the list */
-                               LIST_DEL(&srv_conn->list);
-                               LIST_INIT(&srv_conn->list);
+                               MT_LIST_DEL(&srv_conn->list);
                        }
 
                        if (avail >= 1) {
@@ -1404,7 +1403,7 @@ int connect_server(struct stream *s)
                 */
                if (srv && ((s->be->options & PR_O_REUSE_MASK) == PR_O_REUSE_ALWS) &&
                    srv_conn->mux->avail_streams(srv_conn) > 0)
-                       LIST_ADD(&srv->available_conns[tid], &srv_conn->list);
+                       LIST_ADDQ(&srv->available_conns[tid], mt_list_to_list(&srv_conn->list));
        }
        /* The CO_FL_SEND_PROXY flag may have been set by the connect method,
         * if so, add our handshake pseudo-XPRT now.
index 55b7031718c0a6f81c677937f66b5c11b16f78c4..45d81d8ba02bbb2c58e11dc6b1ebea00d77b846b 100644 (file)
@@ -55,7 +55,7 @@ int conn_create_mux(struct connection *conn)
                srv = objt_server(conn->target);
                if (srv && ((srv->proxy->options & PR_O_REUSE_MASK) != PR_O_REUSE_NEVR) &&
                    conn->mux->avail_streams(conn) > 0)
-                       LIST_ADD(&srv->available_conns[tid], &conn->list);
+                       LIST_ADDQ(&srv->available_conns[tid], mt_list_to_list(&conn->list));
                return 0;
 fail:
                /* let the upper layer know the connection failed */
index 3082d4be803d871476d57af37150b2cbaeab3671..904ce85d433aeff9707a4a9d501469dbdf0b3052 100644 (file)
@@ -3507,9 +3507,9 @@ static void fcgi_detach(struct conn_stream *cs)
                                TRACE_DEVEL("reusable idle connection", FCGI_EV_STRM_END, fconn->conn);
                                return;
                        }
-               } else if (LIST_ISEMPTY(&fconn->conn->list) &&
+               } else if (MT_LIST_ISEMPTY(&fconn->conn->list) &&
                           fcgi_avail_streams(fconn->conn) > 0 && objt_server(fconn->conn->target)) {
-                               LIST_ADD(&__objt_server(fconn->conn->target)->available_conns[tid], &fconn->conn->list);
+                               LIST_ADD(&__objt_server(fconn->conn->target)->available_conns[tid], mt_list_to_list(&fconn->conn->list));
                        }
 
        }
index 47b9068db55255c35bfa22e467190cd868fa5b97..0d42324d78f26f6303cdf8c777e42def52416682 100644 (file)
@@ -3906,9 +3906,9 @@ static void h2_detach(struct conn_stream *cs)
                                        return;
 
                                }
-                       } else if (LIST_ISEMPTY(&h2c->conn->list) &&
+                       } else if (MT_LIST_ISEMPTY(&h2c->conn->list) &&
                                   h2_avail_streams(h2c->conn) > 0 && objt_server(h2c->conn->target)) {
-                               LIST_ADD(&__objt_server(h2c->conn->target)->available_conns[tid], &h2c->conn->list);
+                               LIST_ADD(&__objt_server(h2c->conn->target)->available_conns[tid], mt_list_to_list(&h2c->conn->list));
                        }
                }
        }