From c98df5fb4409160a60f1d391059be42568ea13e4 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Wed, 14 Oct 2020 18:17:05 +0200 Subject: [PATCH] MINOR: connection: improve list api usage Replace !LIST_ISEMPTY by LIST_ADDED and LIST_DEL+LIST_INIT by LIST_DEL_INIT for connection session list. --- include/haproxy/connection.h | 2 +- include/haproxy/session.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/haproxy/connection.h b/include/haproxy/connection.h index 2e01a2d54..37d3f4280 100644 --- a/include/haproxy/connection.h +++ b/include/haproxy/connection.h @@ -468,7 +468,7 @@ static inline void conn_free(struct connection *conn) /* The connection is private, so remove it from the session's * connections list, if any. */ - if (!LIST_ISEMPTY(&conn->session_list)) + if (LIST_ADDED(&conn->session_list)) session_unown_conn(conn->owner, conn); } else { diff --git a/include/haproxy/session.h b/include/haproxy/session.h index 05c56f602..59945b2ba 100644 --- a/include/haproxy/session.h +++ b/include/haproxy/session.h @@ -80,8 +80,7 @@ static inline void session_unown_conn(struct session *sess, struct connection *c if (conn->flags & CO_FL_SESS_IDLE) sess->idle_conns--; - LIST_DEL(&conn->session_list); - LIST_INIT(&conn->session_list); + LIST_DEL_INIT(&conn->session_list); list_for_each_entry(srv_list, &sess->srv_list, srv_list) { if (srv_list->target == conn->target) { if (LIST_ISEMPTY(&srv_list->conn_list)) {