]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: sessions: Don't keep an extra idle connection in sessions.
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 4 Jul 2019 12:26:41 +0000 (14:26 +0200)
committerOlivier Houchard <cognet@ci0.org>
Thu, 4 Jul 2019 12:28:18 +0000 (14:28 +0200)
When deciding if we keep an idle connection in the session, check if
the number of connections currently in the session is >= the max allowed,
not >, or we'll keep an extra connection.

This should be backported to 1.9 and 2.0.

include/proto/session.h

index eabebb85afc6034c2ec7323d6daff2c9c08a4b75..a80f97dc132b3981bece0d229a788855395ed924 100644 (file)
@@ -120,7 +120,7 @@ static inline int session_add_conn(struct session *sess, struct connection *conn
 /* Returns 0 if the session can keep the idle conn, -1 if it was destroyed, or 1 if it was added to the server list */
 static inline int session_check_idle_conn(struct session *sess, struct connection *conn)
 {
-       if (sess->idle_conns > sess->fe->max_out_conns) {
+       if (sess->idle_conns >= sess->fe->max_out_conns) {
                /* We can't keep the connection, let's try to add it to the server idle list */
                session_unown_conn(sess, conn);
                conn->owner = NULL;