From 9872af4d22b9fb87125a0aa6b6fbc75f7e6d1688 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..723fc598c 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 == 1) { + continue; + } sp->done = 1; int rc; rc = pthread_cancel(sp->thr);