From 589fb12904608f2f5dcd89ae1f61e229f0bc1865 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 22 Apr 2024 18:49:55 +0200 Subject: [PATCH] BUG/MEDIUM: applet: Let's applets decide if they have more data to deliver Unlike the muxes, the applets have the responsibility to notify the SC if they have more data to deliver to the stream. The same is done to notify the SC that applets must be woken up ASAP to continue some processing. When an applet is woken up, we pretend it has no more data to deliver by setting SE_FL_HAVE_NO_DATA flag. If the applet removes this flag, we must take care to not set it again just after. Otherwise, the applet may remain blocked if there is no other condition to wake it up. It is an issue for the applets using their own buffers because SE_FL_HAVE_NO_DATA is erroneously set in sc_applet_recv() function, after the applet execution. For instance, it happens for the cli applet when a huge map is cleared. No data are delivered to the stream but we pretend it is the case to clear the map per batches. This patch should fix the issue #2543. No Backported needed. --- src/stconn.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/stconn.c b/src/stconn.c index 930b92b1b..621d51e42 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -2094,9 +2094,7 @@ int sc_applet_recv(struct stconn *sc) } done_recv: - if (!cur_read) - se_have_no_more_data(sc->sedesc); - else { + if (cur_read) { channel_check_xfer(ic, cur_read); sc_ep_report_read_activity(sc); } @@ -2125,12 +2123,7 @@ int sc_applet_recv(struct stconn *sc) sc->flags |= SC_FL_ERROR; ret = 1; } - else if (!cur_read && - !(sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM)) && - !(sc->flags & (SC_FL_EOS|SC_FL_ABRT_DONE))) { - se_have_no_more_data(sc->sedesc); - } - else { + else if (cur_read || (sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM))) { se_have_more_data(sc->sedesc); ret = 1; }