]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stream-int: call si_cs_process() in stream_int_update_conn
authorWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2018 12:32:08 +0000 (13:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2018 12:48:06 +0000 (13:48 +0100)
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

index 08814cf39912bd9c4bb9c895f58b2599deafc8f1..4fd23c3a4d9fd6732b7319b4c9a329ef3cf1112f 100644 (file)
@@ -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);
        }
 }