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.
This commit is contained in:
Christopher Faulet 2024-04-22 18:49:55 +02:00
parent 341bf913d4
commit 589fb12904

View File

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