From fab82bfd55c31744a8792272c2aa6ae04abb76bd Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 5 May 2023 11:30:16 +0200 Subject: [PATCH] BUG/MEDIUM: stconn: Unblock SC from stream if there is enough room to progrees At the end of process_stream(), in sc_update_rx(), the SC is now unblocked if it was waiting for room and the free space in the input buffer is large enough. This patch should fix an issue with the compression filter that can leave the channel's buffer empty while the endpoint is waiting for room to progress. Indeed, in this case, because the buffer is empty, there is no send attempt and no other way to unblock the SE. This commit depends on following commits: * MEDIUM: tree-wide: Change sc API to specify required free space to progress * MINOR: stconn: Add a field to specify the room needed by the SC to progress * MINOR: peers: Use the applet API to send message * MINOR: stats: Use the applet API to write data * MINOR: cli: Use applet API to write output message It should fix a regression introduced with the commit 341a5783b ("BUG/MEDIUM: stconn: stop to enable/disable reads from streams via si_update_rx"). It must be backported iff the commit above is also backported. It was not backported yet and it is thus probably a good idea to not do so to avoid to backport too many change.. --- src/stconn.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/stconn.c b/src/stconn.c index 615a97cc6..41172519f 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -973,6 +973,13 @@ void sc_update_rx(struct stconn *sc) if (sc->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)) return; + /* Unblock the SC if it needs room and the free space is large enough (0 + * means it can always be unblocked). Do not unblock it if -1 was + * specified. + */ + if (!sc->room_needed || (sc->room_needed > 0 && channel_recv_max(ic) >= sc->room_needed)) + sc_have_room(sc); + /* Read not closed, update FD status and timeout for reads */ if (ic->flags & CF_DONT_READ) sc_wont_read(sc);