diff --git a/include/haproxy/channel.h b/include/haproxy/channel.h index 64e95afbf0..c0ff15ccc5 100644 --- a/include/haproxy/channel.h +++ b/include/haproxy/channel.h @@ -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 diff --git a/src/stconn.c b/src/stconn.c index 143f031fd5..a9bd3b9daa 100644 --- a/src/stconn.c +++ b/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);