Exit if idle time expires waiting for a connection in one-off mode. #1187 (#1197)

This commit is contained in:
Mark Feit 2021-09-02 17:20:26 -04:00 committed by GitHub
parent 709f552cf7
commit 775341de11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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;
}
}