From 552b1529b409a3beb669c15f9ef06c14f30e8c74 Mon Sep 17 00:00:00 2001 From: DavidBar-On Date: Fri, 13 Dec 2024 14:40:01 +0200 Subject: [PATCH] Additional debug messages as Nread() returned 0 --- src/iperf_api.c | 5 +++-- src/net.c | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/iperf_api.c b/src/iperf_api.c index a40184aa5..c48684db1 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -2761,6 +2761,7 @@ JSON_read(int fd, int max_size) char *str; cJSON *json = NULL; int rc; + char msg_buf[256]; /* * Read a four-byte integer, which is the length of the JSON to follow. @@ -2788,8 +2789,8 @@ JSON_read(int fd, int max_size) json = cJSON_Parse(str); } else { -printf("*** TEMP DEBUG - Parameters JSON: expected %d bytes but received %d bytes;\n", hsize, rc); // [DBO] ??? - warning("JSON size of data read does not correspond to offered length"); + sprintf(msg_buf, "JSON size of data read does not correspond to offered length - expected %d bytes but received %d bytes; errno=%d", hsize, rc, errno); + warning(msg_buf); } } free(str); diff --git a/src/net.c b/src/net.c index b693ea7fb..9d9921431 100644 --- a/src/net.c +++ b/src/net.c @@ -398,12 +398,14 @@ Nread(int fd, char *buf, size_t count, int prot) return NET_HARDERROR; } if (r == 0) { +printf("*** TEMP DEBUG: Nread() select() 1 returned 0 (timeout), errno=%d;\n", errno); // [DBO] ??? return 0; } } while (nleft > 0) { r = read(fd, buf, nleft); +printf("*** TEMP DEBUG: Nread() read() returned %ld, errno=%d;\n", r, errno); // [DBO] ??? if (r < 0) { /* XXX EWOULDBLOCK can't happen without non-blocking sockets */ if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) @@ -445,6 +447,7 @@ Nread(int fd, char *buf, size_t count, int prot) return NET_HARDERROR; } if (r == 0) { +printf("*** TEMP DEBUG: Nread() select() 2 returned 0 (timeout), errno=%d;\n", errno); // [DBO] ??? break; } }