stream: Close if read() == 0

pull/30/head
Andri Yngvason 2020-03-24 19:14:43 +00:00
parent b3b41d312a
commit f0974e5af6
1 changed files with 4 additions and 1 deletions

View File

@ -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) 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 #ifdef ENABLE_TLS