Skip to content

Commit

Permalink
Exit if idle time expires waiting for a connection in one-off mode. e…
Browse files Browse the repository at this point in the history
  • Loading branch information
mfeit-internet2 authored Sep 2, 2021
1 parent 709f552 commit 775341d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/iperf3.1
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,13 @@ run in server mode
run the server in background as a daemon
.TP
.BR -1 ", " --one-off
handle one client connection, then exit.
handle one client connection, then exit. If an idle time is set, the
server will exit after that amount of time with no connection.
.TP
.BR --idle-timeout " \fIn\fR"
restart the server after \fIn\fR seconds in case it gets stuck. In
one-off mode, this is the number of seconds the server will wait
before exiting.
.TP
.BR --server-bitrate-limit " \fIn\fR[KMGT]"
set a limit on the server side, which will cause a test to abort if
Expand Down
7 changes: 7 additions & 0 deletions src/iperf_server_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,13 @@ iperf_run_server(struct iperf_test *test)
printf("Server restart (#%d) in idle state as no connection request was received for %d sec\n",
test->server_forced_idle_restarts_count, test->settings->idle_timeout);
cleanup_server(test);
if ( iperf_get_test_one_off(test) ) {
if (test->debug)
printf("No connection request was received for %d sec in one-off mode; exiting.\n",
test->settings->idle_timeout);
exit(0);
}

return 2;
}
}
Expand Down

0 comments on commit 775341d

Please sign in to comment.