CLEANUP: session: slightly simplify idle connection cleanup logic
Since previous commit a132e5efa9 ("BUG/MEDIUM: Make sure we leave the
session list in session_free().") it's pointless to delete the conn
element inside "if" blocks given that the second test is always true
as well. Let's simplify this with a single LIST_DEL_INIT() before the
test.
diff --git a/src/session.c b/src/session.c
index c9bdd94..126ba78 100644
--- a/src/session.c
+++ b/src/session.c
@@ -78,10 +78,8 @@
conn->mux->destroy(conn->ctx);
list_for_each_entry_safe(srv_list, srv_list_back, &sess->srv_list, srv_list) {
list_for_each_entry_safe(conn, conn_back, &srv_list->conn_list, session_list) {
+ LIST_DEL_INIT(&conn->session_list);
if (conn->mux) {
-
- LIST_DEL(&conn->session_list);
- LIST_INIT(&conn->session_list);
conn->owner = NULL;
conn->flags &= ~CO_FL_SESS_IDLE;
if (!srv_add_to_idle_list(objt_server(conn->target), conn))
@@ -90,10 +88,6 @@
/* We have a connection, but not yet an associated mux.
* So destroy it now.
*/
- if (!LIST_ISEMPTY(&conn->session_list)) {
- LIST_DEL(&conn->session_list);
- LIST_INIT(&conn->session_list);
- }
conn_stop_tracking(conn);
conn_full_close(conn);
conn_free(conn);