From eafd8ebcfea4940f69f064c84fd4a4f270b212ce Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 28 Oct 2018 13:32:08 +0100 Subject: [PATCH] MEDIUM: stream-int: call si_cs_process() in stream_int_update_conn Calling si_cs_send() alone is always dangerous because it can result in the loss of an event if it manages to empty the buffer. Indeed, in this case it's critical to call si_chk_rcv() on the opposite stream-int. Given that si_cs_process() takes care of all this, let's call it instead. All this code could possibly be refined soon to avoid redoing the whole stream_int_notify() and do it only after a send(), but at the moment it's not important. --- src/stream_interface.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/stream_interface.c b/src/stream_interface.c index 08814cf399..4fd23c3a4d 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -815,14 +815,11 @@ void stream_int_update_conn(struct stream_interface *si) /* Read not closed, it doesn't seem we have to do anything here */ } - if (!(oc->flags & CF_SHUTW)) { - /* Write not closed */ - if (!channel_is_empty(oc) && - !(cs->conn->flags & CO_FL_ERROR) && - !(cs->flags & CS_FL_ERROR) && - !(oc->flags & CF_SHUTW) && - !(si->wait_event.wait_reason & SUB_CAN_SEND)) - si_cs_send(cs); + if (!(oc->flags & CF_SHUTW) && /* Write not closed */ + !channel_is_empty(oc) && + !(cs->flags & CS_FL_ERROR) && + !(cs->conn->flags & CO_FL_ERROR)) { + si_cs_process(cs); } } -- 2.39.5