diff --git a/iiod-responder.c b/iiod-responder.c index 337c91343..5cd00d24d 100644 --- a/iiod-responder.c +++ b/iiod-responder.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #ifdef _WIN32 #include @@ -160,8 +159,6 @@ static ssize_t iiod_rw_all(struct iiod_responder *priv, else ret = priv->ops->write(priv->d, curr, nb); if (ret <= 0) { - printf("Got an error or stop event(%zd) (%lu)\n", ret, - pthread_self()); return ret; } while (ret && (size_t) ret >= curr->size) { diff --git a/iiod/rw.c b/iiod/rw.c index 3796a4e89..86ef6562f 100644 --- a/iiod/rw.c +++ b/iiod/rw.c @@ -7,6 +7,7 @@ */ #include "ops.h" +#include ssize_t write_all(struct parser_pdata *pdata, const void *src, size_t len) { @@ -31,10 +32,14 @@ ssize_t read_all(struct parser_pdata *pdata, void *dst, size_t len) while (len) { ssize_t ret = pdata->readfd(pdata, (void *) ptr, len); - if (ret < 0) + if (ret < 0) { + printf("Got an error(%zd) (%lu)\n", ret, pthread_self()); return ret; - if (!ret) + } + if (!ret) { + printf("Connection closed(%lu)\n", pthread_self()); return -EPIPE; + } ptr += ret; len -= ret; }