]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connections: Add a flag to know if we're in the safe or idle list.
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 10 Mar 2020 17:04:37 +0000 (18:04 +0100)
committerOlivier Houchard <cognet@ci0.org>
Thu, 19 Mar 2020 21:07:33 +0000 (22:07 +0100)
Add flags to connections, CO_FL_SAFE_LIST and CO_FL_IDLE_LIST, to let one
know we are in the safe list, or the idle list.

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

index ca794ab9c6cf12acbe26a524084c35a356301b21..7ba9c8346ea05dc0cbffe3a1aa12feed9b601c71 100644 (file)
@@ -262,6 +262,8 @@ static inline int srv_add_to_idle_list(struct server *srv, struct connection *co
                        return 0;
                }
                MT_LIST_DEL(&conn->list);
+               conn->flags = (conn->flags &~ CO_FL_LIST_MASK) |
+                             (is_safe ? CO_FL_SAFE_LIST : CO_FL_IDLE_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 32a8590ebcc6dfdc61c7e64cc5659977e9ac95b4..4f02895f0910e052280da97e82a8632606002bc5 100644 (file)
@@ -140,6 +140,10 @@ enum {
        CO_FL_NONE          = 0x00000000,  /* Just for initialization purposes */
 
        /* Do not change these values without updating conn_*_poll_changes() ! */
+       CO_FL_SAFE_LIST     = 0x00000001,  /* 0 = not in any list, 1 = in safe_list  */
+       CO_FL_IDLE_LIST     = 0x00000002,  /* 2 = in idle_list, 3 = invalid */
+       CO_FL_LIST_MASK     = 0x00000003,  /* Is the connection in any server-managed list ? */
+
        /* unused : 0x00000001 */
        /* unused : 0x00000002 */
        /* unused : 0x00000004, 0x00000008 */
index b60e9000a244392deb9e15c1d1bdda3076495a5e..c868d93e293e65d1a075160dc89a9c1726cbedbd 100644 (file)
@@ -1173,6 +1173,7 @@ int connect_server(struct stream *s)
                if (srv_conn) {
                        reuse_orphan = 1;
                        reuse = 1;
+                       srv_conn->flags &= ~CO_FL_LIST_MASK;
                }
        }