aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOndrej Lichtner <ondrej.lichtner@gmail.com>2019-10-02 01:55:14 +0200
committerBruce A. Mah <bmah@es.net>2019-10-01 16:55:14 -0700
commit80353b0ada57f16ec97ae7bf8f5d232585924acd (patch)
tree7225d043ebce153ffd98fd779d7fb29041bcc7a1 /src
parent22da02dcfbb2209f02515af5026f928798b8adc5 (diff)
downloadiperf3-80353b0ada57f16ec97ae7bf8f5d232585924acd.tar.gz
fix: fix burst mode throttle checking (#898)
When burst mode is configured for unlimited rate (-b0) but with a specific packet burst value (e.g. /1000), iperf only sends packets once, after that the iperf_check_throttle function gets called and sets green_light=0 due to the rate value being 0 and average calculated rate always being higher than 0. The iperf_check_throttle function is designed to be skipped in case the target rate is unlimited or if a specific burst value was configured, however this skip is only utilized in one place where the function is called leading to the situation above. This can be fixed by moving the "skip throttling" condition directly inside the iperf_check_throttle function. Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/iperf_api.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/iperf_api.c b/src/iperf_api.c
index 3129cf8..3b7e45e 100755
--- a/src/iperf_api.c
+++ b/src/iperf_api.c
@@ -1411,7 +1411,7 @@ iperf_check_throttle(struct iperf_stream *sp, struct iperf_time *nowP)
double seconds;
uint64_t bits_per_second;
- if (sp->test->done)
+ if (sp->test->done || sp->test->settings->rate == 0 || sp->test->settings->burst != 0)
return;
iperf_time_diff(&sp->result->start_time_fixed, nowP, &temp_time);
seconds = iperf_time_in_secs(&temp_time);
@@ -1456,8 +1456,7 @@ iperf_send(struct iperf_test *test, fd_set *write_setP)
streams_active = 1;
test->bytes_sent += r;
++test->blocks_sent;
- if (test->settings->rate != 0 && test->settings->burst == 0)
- iperf_check_throttle(sp, &now);
+ iperf_check_throttle(sp, &now);
if (multisend > 1 && test->settings->bytes != 0 && test->bytes_sent >= test->settings->bytes)
break;
if (multisend > 1 && test->settings->blocks != 0 && test->blocks_sent >= test->settings->blocks)