MEDIUM: stream-int: temporarily make si_chk_rcv() take care of SI_FL_WAIT_ROOM

This flag should already be cleared before calling the *chk_rcv() functions.
Before adapting all call places, let's first make sure si_chk_rcv() clears
it before calling them so that these functions do not have to check it again
and so that they do not adjust it. This function will only call the lower
layers if the SI_FL_WANT_PUT flag is present so that the endpoint can decide
not to be called (as done with applets).
This commit is contained in:
Willy Tarreau 2018-11-07 11:55:54 +01:00
parent 57f08bb63b
commit 96aadd5c55
2 changed files with 9 additions and 6 deletions

View File

@ -385,9 +385,17 @@ static inline void si_update(struct stream_interface *si)
si->ops->update(si);
}
/* Calls chk_rcv on the connection using the data layer */
/* This is to be used after making some room available in a channel. It will
* clear SI_FL_WAIT_ROOM, then if SI_FL_WANT_PUT is set, will calls ->chk_rcv()
* to enable receipt of new data.
*/
static inline void si_chk_rcv(struct stream_interface *si)
{
si->flags &= ~SI_FL_WAIT_ROOM;
if (!(si->flags & SI_FL_WANT_PUT))
return;
si->ops->chk_rcv(si);
}

View File

@ -257,7 +257,6 @@ static void stream_int_chk_rcv(struct stream_interface *si)
}
else {
/* (re)start reading */
si->flags &= ~SI_FL_WAIT_ROOM;
tasklet_wakeup(si->wait_event.task);
if (!(si->flags & SI_FL_DONT_WAKE))
task_wakeup(si_task(si), TASK_WOKEN_IO);
@ -970,7 +969,6 @@ static void stream_int_chk_rcv_conn(struct stream_interface *si)
}
else {
/* (re)start reading */
si->flags &= ~SI_FL_WAIT_ROOM;
tasklet_wakeup(si->wait_event.task);
}
}
@ -1502,9 +1500,6 @@ static void stream_int_chk_rcv_applet(struct stream_interface *si)
if (unlikely(si->state != SI_ST_EST || (ic->flags & (CF_SHUTR|CF_DONT_READ))))
return;
/* here we only wake the applet up if it was waiting for some room */
if (!(si->flags & SI_FL_WAIT_ROOM))
return;
if (channel_may_recv(ic) && !ic->pipe) {
/* (re)start reading */