BUG/MEDIUM: stconn: Do nothing in sc_conn_recv() when the SC needs more room

We erroneously though that an attempt to receive data was not possible if the SC
was waiting for more room in the channel buffer. A BUG_ON() was added to detect
bugs. And in fact, it is possible.

The regression was added in commit 341a5783b ("BUG/MEDIUM: stconn: stop to
enable/disable reads from streams via si_update_rx").

This patch should fix the issue #2115. It must be backported if the commit
above is backported.
This commit is contained in:
Christopher Faulet 2023-04-12 18:35:18 +02:00
parent 915ba08b57
commit 95125886ee

View File

@ -1194,7 +1194,7 @@ static int sc_conn_recv(struct stconn *sc)
/* If another call to sc_conn_recv() failed, and we subscribed to
* recv events already, give up now.
*/
if (sc->wait_event.events & SUB_RETRY_RECV)
if ((sc->wait_event.events & SUB_RETRY_RECV) || sc_waiting_room(sc))
return 0;
/* maybe we were called immediately after an asynchronous shutr */
@ -1220,7 +1220,6 @@ static int sc_conn_recv(struct stconn *sc)
/* prepare to detect if the mux needs more room */
sc_ep_clr(sc, SE_FL_WANT_ROOM);
BUG_ON(sc_waiting_room(sc));
if ((ic->flags & (CF_STREAMER | CF_STREAMER_FAST)) && !co_data(ic) &&
global.tune.idle_timer &&