Skip to content

Commit

Permalink
enh: do not fail when new connection is refused during a running test (
Browse files Browse the repository at this point in the history
  • Loading branch information
davidBar-On authored Apr 13, 2021
1 parent 8464c3c commit 27695dc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/iperf_server_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,15 @@ iperf_accept(struct iperf_test *test)
/*
* Don't try to read from the socket. It could block an ongoing test.
* Just send ACCESS_DENIED.
* Also, if sending failed, don't return an error, as the request is not related
* to the ongoing test, and returning an error will terminate the test.
*/
if (Nwrite(s, (char*) &rbuf, sizeof(rbuf), Ptcp) < 0) {
i_errno = IESENDMESSAGE;
return -1;
if (test->debug)
printf("failed to send ACCESS_DENIED to an unsolicited connection requist during active test\n");
} else {
if (test->debug)
printf("successfully sent ACCESS_DENIED to an unsolicited connection requist during active test\n");
}
close(s);
}
Expand Down

0 comments on commit 27695dc

Please sign in to comment.