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.
This commit is contained in:
Christopher Faulet 2024-04-18 09:05:11 +02:00
parent 4fd656e311
commit 494bc03ff7

View 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;
}