]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: peers: Fix exit condition when max-updates-at-once is reached
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 18 Apr 2024 07:05:11 +0000 (09:05 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 18 Apr 2024 07:17:03 +0000 (09:17 +0200)
When a peer applet is pushing updates, we limit the number of update sent at
once via a global parameter to not spend too much time in the applet. On
interrupt, we claimed for more room to be woken up quickly. However, this
statement is only true if something was pushed in the buffer. Otherwise,
with an empty buffer, if the stream itself is not woken up, the applet
remains also blocked because there is no send activity on the other side to
unblock it.

In this case, instead of requesting more room, it is sufficient to state the
applet have more data to send.

This patch must be backported as far as 2.6.

src/peers.c

index d6b4012b6db7645f4e7a3d9c934979b2393630ad..904eb446a972845ea077c3c5b1b3491be5a14726 100644 (file)
@@ -1637,10 +1637,7 @@ static inline int peer_send_teachmsgs(struct appctx *appctx, struct peer *p,
 
                updates_sent++;
                if (updates_sent >= peers_max_updates_at_once) {
-                       /* pretend we're full so that we get back ASAP */
-                       struct stconn *sc = appctx_sc(appctx);
-
-                       sc_need_room(sc, 0);
+                       applet_have_more_data(appctx);
                        ret = -1;
                        break;
                }
@@ -2695,10 +2692,7 @@ static inline int peer_send_msgs(struct appctx *appctx,
 
                        updates++;
                        if (updates >= peers_max_updates_at_once) {
-                               /* pretend we're full so that we get back ASAP */
-                               struct stconn *sc = appctx_sc(appctx);
-
-                               sc_need_room(sc, 0);
+                               applet_have_more_data(appctx);
                                return -1;
                        }