diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c index f0c4a5894..f609cc40c 100644 --- a/src/iperf_client_api.c +++ b/src/iperf_client_api.c @@ -662,12 +662,6 @@ iperf_run_client(struct iperf_test * test) goto cleanup_and_fail; } - // Set non-blocking for non-UDP tests - if (test->protocol->id != Pudp) { - SLIST_FOREACH(sp, &test->streams, streams) { - setnonblocking(sp->socket, 1); - } - } } /* Run the timers. */ @@ -706,13 +700,6 @@ iperf_run_client(struct iperf_test * test) iperf_printf(test, "Sender threads stopped\n"); } - // Unset non-blocking for non-UDP tests - if (test->protocol->id != Pudp) { - SLIST_FOREACH(sp, &test->streams, streams) { - setnonblocking(sp->socket, 0); - } - } - /* Yes, done! Send TEST_END. */ test->done = 1; cpu_util(test->cpu_util); diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index f36eaa367..21fcc2d7a 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -757,17 +757,6 @@ iperf_run_server(struct iperf_test *test) if (s > test->max_fd) test->max_fd = s; - /* - * If the protocol isn't UDP, or even if it is but - * we're the receiver, set nonblocking sockets. - * We need this to allow a server receiver to - * maintain interactivity with the control channel. - */ - if (test->protocol->id != Pudp || - !sp->sender) { - setnonblocking(s, 1); - } - if (test->on_new_stream) test->on_new_stream(sp); diff --git a/src/net.c b/src/net.c index b80fb64aa..c82caff1b 100644 --- a/src/net.c +++ b/src/net.c @@ -1,5 +1,5 @@ /* - * iperf, Copyright (c) 2014-2019, The Regents of the University of + * iperf, Copyright (c) 2014-2023, The Regents of the University of * California, through Lawrence Berkeley National Laboratory (subject * to receipt of any required approvals from the U.S. Dept. of * Energy). All rights reserved. @@ -405,6 +405,7 @@ Nread(int fd, char *buf, size_t count, int prot) while (nleft > 0) { r = read(fd, buf, nleft); if (r < 0) { + /* XXX EWOULDBLOCK can't happen without non-blocking sockets */ if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) break; else @@ -469,6 +470,7 @@ Nwrite(int fd, const char *buf, size_t count, int prot) case EINTR: case EAGAIN: #if (EAGAIN != EWOULDBLOCK) + /* XXX EWOULDBLOCK can't happen without non-blocking sockets */ case EWOULDBLOCK: #endif return count - nleft; @@ -539,6 +541,7 @@ Nsendfile(int fromfd, int tofd, const char *buf, size_t count) case EINTR: case EAGAIN: #if (EAGAIN != EWOULDBLOCK) + /* XXX EWOULDBLOCK can't happen without non-blocking sockets */ case EWOULDBLOCK: #endif if (count == nleft)