From 5e7ea0bd1ef6564a06dad950e7ef99800e36957c Mon Sep 17 00:00:00 2001 From: Yun Jiang <66518086+yjiang-c@users.noreply.github.com> Date: Tue, 7 Jul 2020 16:01:35 +0100 Subject: fix: Prevent 100% CPU usage when --bidir option is enabled. (#1011) --- src/iperf_api.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/iperf_api.c b/src/iperf_api.c index 6d91fb7..412c527 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -1480,7 +1480,8 @@ iperf_send(struct iperf_test *test, fd_set *write_setP) if (test->settings->burst != 0) { iperf_time_now(&now); SLIST_FOREACH(sp, &test->streams, streams) - iperf_check_throttle(sp, &now); + if (sp->sender) + iperf_check_throttle(sp, &now); } if (write_setP != NULL) SLIST_FOREACH(sp, &test->streams, streams) @@ -1562,7 +1563,7 @@ iperf_create_send_timers(struct iperf_test * test) } SLIST_FOREACH(sp, &test->streams, streams) { sp->green_light = 1; - if (test->settings->rate != 0) { + if (test->settings->rate != 0 && sp->sender) { cd.p = sp; sp->send_timer = tmr_create(NULL, send_timer_proc, cd, test->settings->pacing_timer, 1); if (sp->send_timer == NULL) { -- cgit v1.2.3