From: Willy Tarreau Date: Sun, 28 Oct 2018 12:32:08 +0000 (+0100) Subject: MEDIUM: stream-int: call si_cs_process() in stream_int_update_conn X-Git-Tag: v1.9-dev5~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eafd8ebcf;p=thirdparty%2Fhaproxy.git 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. --- 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); } }