MEDIUM: channel: don't look at iobuf to report an empty channel
It is important to split channels and I/O buffers. When data are pushed in an I/O buffer, we consider them as forwarded. The channel never sees them. Fast-forwarded data are now handled in the SE only.
This commit is contained in:
parent
c9c0b755c2
commit
2af4188897
|
@ -402,14 +402,13 @@ static inline void channel_htx_forward_forever(struct channel *chn, struct htx *
|
|||
/* These functions are used to compute various channel content sizes */
|
||||
/*********************************************************************/
|
||||
|
||||
/* Reports non-zero if the channel is empty, which means both its
|
||||
* buffer and pipe on the opposite SE are empty. The construct looks
|
||||
* strange but is jump-less and much more efficient on both 32 and
|
||||
* 64-bit than the boolean test.
|
||||
/* Reports non-zero if the channel is empty, which means its buffer is
|
||||
* empty. The construct looks strange but is jump-less and much more efficient
|
||||
* on both 32 and 64-bit than the boolean test.
|
||||
*/
|
||||
static inline unsigned int channel_is_empty(const struct channel *c)
|
||||
{
|
||||
return (!co_data(c) && !sc_ep_have_ff_data(chn_cons(c)));
|
||||
return !co_data(c);
|
||||
}
|
||||
|
||||
/* Returns non-zero if the channel is rewritable, which means that the buffer
|
||||
|
|
14
src/stconn.c
14
src/stconn.c
|
@ -646,7 +646,7 @@ static void sc_app_chk_snd(struct stconn *sc)
|
|||
return;
|
||||
|
||||
if (!sc_ep_test(sc, SE_FL_WAIT_DATA) || /* not waiting for data */
|
||||
channel_is_empty(oc)) /* called with nothing to send ! */
|
||||
(channel_is_empty(oc) && !sc_ep_have_ff_data(sc))) /* called with nothing to send ! */
|
||||
return;
|
||||
|
||||
/* Otherwise there are remaining data to be sent in the buffer,
|
||||
|
@ -798,7 +798,7 @@ static void sc_app_chk_snd_conn(struct stconn *sc)
|
|||
(sc->flags & SC_FL_SHUT_DONE)))
|
||||
return;
|
||||
|
||||
if (unlikely(channel_is_empty(oc))) /* called with nothing to send ! */
|
||||
if (unlikely(channel_is_empty(oc) && !sc_ep_have_ff_data(sc))) /* called with nothing to send ! */
|
||||
return;
|
||||
|
||||
if (!sc_ep_have_ff_data(sc) && /* data wants to be fast-forwarded ASAP */
|
||||
|
@ -967,7 +967,7 @@ static void sc_app_chk_snd_applet(struct stconn *sc)
|
|||
if (!sc_ep_test(sc, SE_FL_WAIT_DATA) || sc_ep_test(sc, SE_FL_WONT_CONSUME))
|
||||
return;
|
||||
|
||||
if (!channel_is_empty(oc)) {
|
||||
if (!channel_is_empty(oc) || sc_ep_have_ff_data(sc)) {
|
||||
/* (re)start sending */
|
||||
appctx_wakeup(__sc_appctx(sc));
|
||||
}
|
||||
|
@ -1679,7 +1679,8 @@ static int sc_conn_send(struct stconn *sc)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (channel_is_empty(oc))
|
||||
/* FIXME: Must be reviewed for FF */
|
||||
if (channel_is_empty(oc) && !sc_ep_have_ff_data(sc))
|
||||
sc_ep_report_send_activity(sc);
|
||||
else {
|
||||
/* We couldn't send all of our data, let the mux know we'd like to send more */
|
||||
|
@ -1730,7 +1731,8 @@ static int sc_conn_process(struct stconn *sc)
|
|||
BUG_ON(!conn);
|
||||
|
||||
/* If we have data to send, try it now */
|
||||
if (!channel_is_empty(oc) && !(sc->wait_event.events & SUB_RETRY_SEND))
|
||||
if ((!channel_is_empty(oc) || sc_ep_have_ff_data(sc)) &&
|
||||
!(sc->wait_event.events & SUB_RETRY_SEND))
|
||||
sc_conn_send(sc);
|
||||
|
||||
/* First step, report to the stream connector what was detected at the
|
||||
|
@ -1822,7 +1824,7 @@ struct task *sc_conn_io_cb(struct task *t, void *ctx, unsigned int state)
|
|||
if (!sc_conn(sc))
|
||||
return t;
|
||||
|
||||
if (!(sc->wait_event.events & SUB_RETRY_SEND) && !channel_is_empty(sc_oc(sc)))
|
||||
if (!(sc->wait_event.events & SUB_RETRY_SEND) && (!channel_is_empty(sc_oc(sc)) || sc_ep_have_ff_data(sc)))
|
||||
ret = sc_conn_send(sc);
|
||||
if (!(sc->wait_event.events & SUB_RETRY_RECV))
|
||||
ret |= sc_conn_recv(sc);
|
||||
|
|
Loading…
Reference in New Issue