Skip to content

Commit

Permalink
Make sockets for non-UDP tests non-blocking (rather than all sender
Browse files Browse the repository at this point in the history
side sockets).  This is reported to fix some oddities after a recent
change in this area.

Somewhat related to Issue #125.

Submitted by:	@i2aaron
  • Loading branch information
bmah888 committed Apr 25, 2014
1 parent f8401df commit 6b16244
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/iperf_client_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/iperf_server_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 6b16244

Please sign in to comment.