Skip to content

Commit

Permalink
test_3
Browse files Browse the repository at this point in the history
  • Loading branch information
nunojsa committed Feb 5, 2025
1 parent eadf98c commit 16930cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 0 additions & 3 deletions iiod-responder.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <iio/iio.h>
#include <iio/iio-backend.h>
#include <iio/iio-lock.h>
#include <pthread.h>
#include <string.h>
#ifdef _WIN32
#include <Windows.h>
Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 7 additions & 2 deletions iiod/rw.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

#include "ops.h"
#include <pthread.h>

ssize_t write_all(struct parser_pdata *pdata, const void *src, size_t len)
{
Expand All @@ -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;
}
Expand Down

0 comments on commit 16930cb

Please sign in to comment.