summaryrefslogtreecommitdiffstats
path: root/lib/receiver.c
diff options
context:
space:
mode:
authorJulian Bouzas <julian.bouzas@collabora.com>2021-06-28 07:49:35 -0400
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2021-07-28 13:19:02 +0300
commit8745cd5d0cba0da5729bb75187aefb01c6b5dc83 (patch)
tree869971fdb0b417efda0bbc6479cce1388a85b2ec /lib/receiver.c
parent17a8b7ea6fc6a0470f83012810f12048f6ae9894 (diff)
wpipc: receiver: also emit sender disconnected when failed to read
Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
Diffstat (limited to 'lib/receiver.c')
-rw-r--r--lib/receiver.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/receiver.c b/lib/receiver.c
index b58e8be..ba7edda 100644
--- a/lib/receiver.c
+++ b/lib/receiver.c
@@ -75,12 +75,9 @@ other_event_received (struct epoll_thread *t, int fd, void *data)
/* sender sends a message, read it and reply */
ssize_t size = icipc_socket_read (fd, &self->buffer_read, &self->buffer_size);
- if (size < 0) {
- icipc_log_error ("receiver: could not read message: %s", strerror(errno));
- return;
- }
-
- if (size == 0) {
+ if (size <= 0) {
+ if (size < 0)
+ icipc_log_error ("receiver: could not read message: %s", strerror(errno));
/* client disconnected */
epoll_ctl (t->epoll_fd, EPOLL_CTL_DEL, fd, NULL);
close (fd);