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 51f2300..72fec21 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -460,10 +460,6 @@
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 @@
(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.
*/