From 494bc03ff73ba82d5ec7a9f9cc8c3d3d72586286 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Thu, 18 Apr 2024 09:05:11 +0200 Subject: [PATCH] BUG/MEDIUM: peers: Fix exit condition when max-updates-at-once is reached 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 | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/peers.c b/src/peers.c index d6b4012b6..904eb446a 100644 --- a/src/peers.c +++ b/src/peers.c @@ -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; }