Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/iperf_client_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,16 @@ iperf_client_worker_run(void *s) {
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);

while (! (test->done) && ! (sp->done)) {
if (sp->sender) {
if (sp->sender) {
// Send until TEST_END
while (! (test->done) && ! (sp->done)) {
if (iperf_send_mt(sp) < 0) {
goto cleanup_and_fail;
}
}
else {
} else { // Receiver
// Receive until EXCHANGE_PARAMETERS to allow receiving late messages
while (! (test->done == 2) && ! (sp->done)) {
if (iperf_recv_mt(sp) < 0) {
goto cleanup_and_fail;
}
Expand Down Expand Up @@ -333,6 +336,7 @@ iperf_handle_message_client(struct iperf_test *test)

switch (test->state) {
case PARAM_EXCHANGE:
test->done = 2; // Stop receiving
if (iperf_exchange_parameters(test) < 0)
return -1;
if (test->on_connect)
Expand Down
2 changes: 1 addition & 1 deletion src/iperf_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ iperf_udp_recv(struct iperf_stream *sp)
return r;

/* Only count bytes received while we're in the correct state. */
if (test->state == TEST_RUNNING) {
if (test->state == TEST_RUNNING || test->state == TEST_END) {

/*
* For jitter computation below, it's important to know if this
Expand Down