From: Olivier Houchard Date: Tue, 28 Aug 2018 17:37:41 +0000 (+0200) Subject: BUG/MEDIUM: stream_interface: try to call si_cs_send() earlier. X-Git-Tag: v1.9-dev2~107 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c7ffa91763de09b9adef197ca3d67395cc411fc2;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: stream_interface: try to call si_cs_send() earlier. 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. --- diff --git a/src/stream_interface.c b/src/stream_interface.c index 51f2300daf..72fec21b6d 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -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. */