]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stream_interface: try to call si_cs_send() earlier.
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 28 Aug 2018 17:37:41 +0000 (19:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 28 Aug 2018 17:46:45 +0000 (19:46 +0200)
Call si_cs_send() at the beginning of si_cs_wake_cb(), instead of from
stream_int_notify-), so that if we get a connection error while trying to
send, the stream_interface will get SI_FL_ERR, the associated task will
be woken up, and the connection will be properly destroyed.

No backport needed.

src/stream_interface.c

index 51f2300dafecb248ac4fbd6fe1b68e2b34c34884..72fec21b6dfe919270d35dc9b7fdfb1f131eccd6 100644 (file)
@@ -460,10 +460,6 @@ void stream_int_notify(struct stream_interface *si)
        struct channel *ic = si_ic(si);
        struct channel *oc = si_oc(si);
 
-       /* If we have data to send, try it now */
-       if (!channel_is_empty(oc) && objt_cs(si->end))
-               si_cs_send(objt_cs(si->end));
-
        /* process consumer side */
        if (channel_is_empty(oc)) {
                struct connection *conn = objt_cs(si->end) ? objt_cs(si->end)->conn : NULL;
@@ -589,6 +585,9 @@ static int si_cs_wake_cb(struct conn_stream *cs)
            (cs->flags & (CS_FL_DATA_RD_ENA|CS_FL_REOS|CS_FL_RCV_MORE)) > CS_FL_DATA_RD_ENA)
                si_cs_recv_cb(cs);
 
+       /* If we have data to send, try it now */
+       if (!channel_is_empty(oc) && objt_cs(si->end))
+               si_cs_send(objt_cs(si->end));
        /* First step, report to the stream-int what was detected at the
         * connection layer : errors and connection establishment.
         */