From fd0c2dcf0052c46ca8790ceb0a2309cdb555140c Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Thu, 13 Dec 2018 15:38:16 +0100 Subject: [PATCH] BUG/MEDIUM: stream_interface: Don't report read0 if we were not connected. In si_cs_recv(), report that arrive at the end of stream only if we were indeed connected, we don't want that if the connection failed and we're about to retry. --- src/stream_interface.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/stream_interface.c b/src/stream_interface.c index 81e1778ea..ae9a76f74 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -1340,11 +1340,13 @@ int si_cs_recv(struct conn_stream *cs) return (cur_read != 0) || si_rx_blocked(si); out_shutdown_r: - /* we received a shutdown */ - ic->flags |= CF_READ_NULL; - if (ic->flags & CF_AUTO_CLOSE) - channel_shutw_now(ic); - stream_sock_read0(si); + if (conn->flags & CO_FL_CONNECTED) { + /* we received a shutdown */ + ic->flags |= CF_READ_NULL; + if (ic->flags & CF_AUTO_CLOSE) + channel_shutw_now(ic); + stream_sock_read0(si); + } return 1; }