Skip to content

Commit b14c3b9

Browse files
committed
Make -n / -k options work correctly.
We need to get the threads to exit when the ending conditions for -n / -k are reached, but we weren't doing that. While here, clean up some not-very-often-used error case code and pet copyright dates. Fixes IPERF-151.
1 parent 30ce2d5 commit b14c3b9

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/iperf_client_api.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* iperf, Copyright (c) 2014-2022, The Regents of the University of
2+
* iperf, Copyright (c) 2014-2023, The Regents of the University of
33
* California, through Lawrence Berkeley National Laboratory (subject
44
* to receipt of any required approvals from the U.S. Dept. of
55
* Energy). All rights reserved.
@@ -56,7 +56,7 @@ iperf_client_worker_run(void *s) {
5656
struct iperf_stream *sp = (struct iperf_stream *) s;
5757
struct iperf_test *test = sp->test;
5858

59-
while (! (test->done)) {
59+
while (! (test->done) && ! (sp->done)) {
6060
if (sp->sender) {
6161
if (iperf_send_mt(sp) < 0) {
6262
goto cleanup_and_fail;
@@ -71,8 +71,6 @@ iperf_client_worker_run(void *s) {
7171
return NULL;
7272

7373
cleanup_and_fail:
74-
/* XXX */
75-
test->done = 0;
7674
return NULL;
7775
}
7876

src/iperf_server_api.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* iperf, Copyright (c) 2014-2022 The Regents of the University of
2+
* iperf, Copyright (c) 2014-2023 The Regents of the University of
33
* California, through Lawrence Berkeley National Laboratory (subject
44
* to receipt of any required approvals from the U.S. Dept. of
55
* Energy). All rights reserved.
@@ -71,7 +71,7 @@ iperf_server_worker_run(void *s) {
7171
struct iperf_stream *sp = (struct iperf_stream *) s;
7272
struct iperf_test *test = sp->test;
7373

74-
while (! (test->done)) {
74+
while (! (test->done) && ! (sp->done)) {
7575
if (sp->sender) {
7676
if (iperf_send_mt(sp) < 0) {
7777
goto cleanup_and_fail;
@@ -86,8 +86,6 @@ iperf_server_worker_run(void *s) {
8686
return NULL;
8787

8888
cleanup_and_fail:
89-
/* XXX */
90-
test->done = 0;
9189
return NULL;
9290
}
9391

0 commit comments

Comments
 (0)