From f0974e5af677461ca94c1cb17f8593115b85a8dd Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Tue, 24 Mar 2020 19:14:43 +0000 Subject: [PATCH] stream: Close if read() == 0 --- src/stream.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/stream.c b/src/stream.c index 557a5b4..349390d 100644 --- a/src/stream.c +++ b/src/stream.c @@ -334,7 +334,10 @@ int stream_write(struct stream* self, const void* payload, size_t len, ssize_t stream__read_plain(struct stream* self, void* dst, size_t size) { - return read(self->fd, dst, size); + ssize_t rc = read(self->fd, dst, size); + if (rc == 0) + stream__remote_closed(self); + return rc; } #ifdef ENABLE_TLS