From 7bd583d323950071e6ad05eb6c72a45a786fb126 Mon Sep 17 00:00:00 2001 From: jiangjixiang Date: Mon, 9 Sep 2024 17:54:25 +0800 Subject: [PATCH] Avoid duplicate thread recycling. At the end of the test, the traffic thread has been reclaimed. If there is an exception in the control connection, it will cause the thread to be reclaimed repeatedly. Use sp->done to avoid repeated thread recycling. --- src/iperf_client_api.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c index 7c22caded..6d8eee2dd 100644 --- a/src/iperf_client_api.c +++ b/src/iperf_client_api.c @@ -807,6 +807,9 @@ iperf_run_client(struct iperf_test * test) /* Cancel all outstanding threads */ i_errno_save = i_errno; SLIST_FOREACH(sp, &test->streams, streams) { + if (sp->done) { + continue; + } sp->done = 1; int rc; rc = pthread_cancel(sp->thr);