From: Christopher Faulet Date: Thu, 2 Jul 2020 13:56:23 +0000 (+0200) Subject: MINOR: session: Take care to decrement idle_conns counter in session_unown_conn X-Git-Tag: v2.3-dev1~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15979619c410fd0e4638d935360c22eef8e8ce39;p=thirdparty%2Fhaproxy.git MINOR: session: Take care to decrement idle_conns counter in session_unown_conn So conn_free() only calls session_unown_conn() if necessary. The details are now fully handled by session_unown_conn(). --- diff --git a/include/haproxy/connection.h b/include/haproxy/connection.h index 8ccb31d38e..094e54cde1 100644 --- a/include/haproxy/connection.h +++ b/include/haproxy/connection.h @@ -463,10 +463,7 @@ static inline void conn_free(struct connection *conn) { /* Remove ourself from the session's connections list, if any. */ if (!LIST_ISEMPTY(&conn->session_list)) { - struct session *sess = conn->owner; - if (conn->flags & CO_FL_SESS_IDLE) - sess->idle_conns--; - session_unown_conn(sess, conn); + session_unown_conn(conn->owner, conn); } sockaddr_free(&conn->src); diff --git a/include/haproxy/session.h b/include/haproxy/session.h index 5a46c4f5bb..05c56f6024 100644 --- a/include/haproxy/session.h +++ b/include/haproxy/session.h @@ -77,6 +77,9 @@ static inline void session_store_counters(struct session *sess) static inline void session_unown_conn(struct session *sess, struct connection *conn) { struct sess_srv_list *srv_list = NULL; + + if (conn->flags & CO_FL_SESS_IDLE) + sess->idle_conns--; LIST_DEL(&conn->session_list); LIST_INIT(&conn->session_list); list_for_each_entry(srv_list, &sess->srv_list, srv_list) {