diff options
author | Andrew Cooks <andrew.d.cooks@boeing.com> | 2019-03-06 15:16:11 +1000 |
---|---|---|
committer | Bruce A. Mah <bmah@es.net> | 2019-06-14 11:38:54 -0700 |
commit | 098dd3cc1b4bc67379e91c95b6dd42e54d80d564 (patch) | |
tree | de616234942c92bde7149cc7d4a215cda488d176 /src | |
parent | 6c7834629a5677802720a2efe496763f55bee269 (diff) | |
download | iperf3-098dd3cc1b4bc67379e91c95b6dd42e54d80d564.tar.gz |
delay tearing down tcp control connections
The TEST_END message is racing with the server_timer_proc timer.
When the RTT is higher than a second, the timer wins the race
and closes the control socket before the results are exchanged.
This results in the client reporting:
"error - control socket has closed unexpectedly"
as reported in GH issue 751.
This change doesn't prevent the race, but significantly increases the
grace period based on a maximum RTT of 4 seconds and accounts for
the ten transitions in the iperf3 state machine.
(cherry picked from commit 34bdddb75194e880e6dbc6dcaa5b5386975c11b3)
(originally submitted by @acooks in #859)
Diffstat (limited to 'src')
-rw-r--r-- | src/iperf_server_api.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index 56cab4b..40d99bc 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -270,6 +270,9 @@ create_server_timers(struct iperf_test * test) { struct iperf_time now; TimerClientData cd; + int max_rtt = 4; /* seconds */ + int state_transitions = 10; /* number of state transitions in iperf3 */ + int grace_period = max_rtt * state_transitions; if (iperf_time_now(&now) < 0) { i_errno = IEINITTEST; @@ -279,7 +282,7 @@ create_server_timers(struct iperf_test * test) test->timer = test->stats_timer = test->reporter_timer = NULL; if (test->duration != 0 ) { test->done = 0; - test->timer = tmr_create(&now, server_timer_proc, cd, (test->duration + test->omit + 5) * SEC_TO_US, 0); + test->timer = tmr_create(&now, server_timer_proc, cd, (test->duration + test->omit + grace_period) * SEC_TO_US, 0); if (test->timer == NULL) { i_errno = IEINITTEST; return -1; |