From 6b16244baa9d1b58cb3de93a4694643597e9f1b0 Mon Sep 17 00:00:00 2001 From: "Bruce A. Mah" Date: Fri, 25 Apr 2014 13:23:13 -0700 Subject: [PATCH] Make sockets for non-UDP tests non-blocking (rather than all sender side sockets). This is reported to fix some oddities after a recent change in this area. Somewhat related to Issue #125. Submitted by: @i2aaron --- src/iperf_client_api.c | 8 ++++---- src/iperf_server_api.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c index 866d446bf..3cbfde330 100644 --- a/src/iperf_client_api.c +++ b/src/iperf_client_api.c @@ -381,8 +381,8 @@ iperf_run_client(struct iperf_test * test) if (startup) { startup = 0; - // If the client is sending (normal mode) then set nonblocking sockets - if (!test->reverse) { + // Set non-blocking for non-UDP tests + if (test->protocol->id != Pudp) { SLIST_FOREACH(sp, &test->streams, streams) { setnonblocking(sp->socket, 1); } @@ -409,8 +409,8 @@ iperf_run_client(struct iperf_test * test) (test->settings->bytes != 0 && test->bytes_sent >= test->settings->bytes) || (test->settings->blocks != 0 && test->blocks_sent >= test->settings->blocks))) { - // If the client is sending (normal mode) then undo nonblocking sockets - if (!test->reverse) { + // Set non-blocking for non-UDP tests + if (test->protocol->id != Pudp) { SLIST_FOREACH(sp, &test->streams, streams) { setnonblocking(sp->socket, 0); } diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index 83a7cb1d1..d375de295 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -516,8 +516,8 @@ iperf_run_server(struct iperf_test *test) FD_SET(s, &test->read_set); if (s > test->max_fd) test->max_fd = s; - // If the server is sending (reverse mode) then set nonblocking sockets - if (test->reverse) { + // If the protocol isn't UDP, set nonblocking sockets + if (test->protocol->id != Pudp) { setnonblocking(s, 1); }