]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: backend: Remove CO_FL_SESS_IDLE if a client remains on the last server
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Jul 2020 16:56:30 +0000 (18:56 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 7 Jul 2020 12:30:26 +0000 (14:30 +0200)
When a connection is picked from the session server list because the proxy or
the session are marked to use the last requested server, if it is idle, we must
marked it as used removing the CO_FL_SESS_IDLE flag and decrementing the session
idle_conns counter.

This patch must be backported as far as 1.9.

src/backend.c

index 7027c54cda24ad3bb846c9925e57bfe8b4f1a9b5..5958a824e9dbf55c811556a8991a7cfeaca7b1ad 100644 (file)
@@ -623,6 +623,10 @@ int assign_server(struct stream *s)
                                        if (!(conn->flags & CO_FL_WAIT_XPRT)) {
                                                srv = tmpsrv;
                                                s->target = &srv->obj_type;
+                                               if (conn->flags & CO_FL_SESS_IDLE) {
+                                                       conn->flags &= ~CO_FL_SESS_IDLE;
+                                                       s->sess->idle_conns--;
+                                               }
                                                goto out_ok;
                                        }
                                }