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.
This commit is contained in:
Amaury Denoyelle 2020-10-14 18:17:05 +02:00 committed by Christopher Faulet
parent 9c13b62b47
commit c98df5fb44
2 changed files with 2 additions and 3 deletions

View File

@ -468,7 +468,7 @@ static inline void conn_free(struct connection *conn)
/* The connection is private, so remove it from the session's /* The connection is private, so remove it from the session's
* connections list, if any. * connections list, if any.
*/ */
if (!LIST_ISEMPTY(&conn->session_list)) if (LIST_ADDED(&conn->session_list))
session_unown_conn(conn->owner, conn); session_unown_conn(conn->owner, conn);
} }
else { else {

View File

@ -80,8 +80,7 @@ static inline void session_unown_conn(struct session *sess, struct connection *c
if (conn->flags & CO_FL_SESS_IDLE) if (conn->flags & CO_FL_SESS_IDLE)
sess->idle_conns--; sess->idle_conns--;
LIST_DEL(&conn->session_list); LIST_DEL_INIT(&conn->session_list);
LIST_INIT(&conn->session_list);
list_for_each_entry(srv_list, &sess->srv_list, srv_list) { list_for_each_entry(srv_list, &sess->srv_list, srv_list) {
if (srv_list->target == conn->target) { if (srv_list->target == conn->target) {
if (LIST_ISEMPTY(&srv_list->conn_list)) { if (LIST_ISEMPTY(&srv_list->conn_list)) {