BUG/MINOR: stream-int: Fix si_cs_recv() return value

The previous patch on this function (36b536d6c "BUG/MEDIUM: stream-int: Don't
loose events on the CS when an EOS is reported") contains a bug. The return
value is based on the conn-stream's flags. But it may be reset if the CS is
closed. Ironically it was exactly the purpose of this patch...

This patch must be backported to 2.0 and 1.9.

(cherry picked from commit e6d8cb1e911267662c92f257f0f42df1ec78d42b)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/stream_interface.c b/src/stream_interface.c
index ba36b6a..e37d0b9 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -1479,14 +1479,19 @@
 	}
 
  end_recv:
+	ret = (cur_read != 0);
+
 	/* Report EOI on the channel if it was reached from the mux point of
 	 * view. */
-	if ((cs->flags & CS_FL_EOI) && !(ic->flags & CF_EOI))
+	if ((cs->flags & CS_FL_EOI) && !(ic->flags & CF_EOI)) {
 		ic->flags |= (CF_EOI|CF_READ_PARTIAL);
+		ret = 1;
+	}
 
 	if (conn->flags & CO_FL_ERROR || cs->flags & CS_FL_ERROR) {
 		cs->flags |= CS_FL_ERROR;
 		si->flags |= SI_FL_ERR;
+		ret = 1;
 	}
 	else if (cs->flags & CS_FL_EOS) {
 		/* connection closed */
@@ -1497,6 +1502,7 @@
 				channel_shutw_now(ic);
 			stream_int_read0(si);
 		}
+		ret = 1;
 	}
 	else if (!si_rx_blocked(si)) {
 		/* Subscribe to receive events if we're blocking on I/O */
@@ -1504,11 +1510,9 @@
 		si_rx_endp_done(si);
 	} else {
 		si_rx_endp_more(si);
+		ret = 1;
 	}
-
-	return (cur_read != 0) ||
-		si_rx_blocked(si) ||
-		(cs->flags & (CS_FL_EOI|CS_FL_EOS|CS_FL_ERROR));
+	return ret;
 }
 
 /*