BUG/MEDIUM: stconn: Wake applets on sending path if there is a pending shutdown

An applet is not woken up on sending path if it is not waiting for data or
if it states it will not consume data. However, it is important to still
wake it up if there is a pending shutdown. Otherwise, the event may be
missed and some data may remain blocked in the channel's buffer.

Because of this bug, it is possible to have a stream stuck if data are also
blocked on the opposite channel. It is for instance possible to hit the buf
with the stats applet and a client not consuming data.

This patch must slowly be backported as far as 2.2. It should partially fix
issue #2249.

(cherry picked from commit 0b93ff8c87d6813372a28e9af0af86beeae2ec28)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit f227db4bbff8ae3af04e7bde03ab423071ef9858)
[cf: Use CF_SHUTW_NOW instead of SC_FL_SHUT_WANTED]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit b3f6924731033d4dc203ea8d8f2933f5e89a7c3f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 3cab46ecb7a5decfb4af0bf5d41ef78c9f2dc540)
[cf: patch applied on stream_interface.c]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/stream_interface.c b/src/stream_interface.c
index d2f4752..787adfc 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -1793,7 +1793,7 @@
 
 	/* we only wake the applet up if it was waiting for some data */
 
-	if (!(si->flags & SI_FL_WAIT_DATA))
+	if (!(si->flags & SI_FL_WAIT_DATA) && !(oc->flags & CF_SHUTW_NOW))
 		return;
 
 	if (!tick_isset(oc->wex))