Skip to content

Commit

Permalink
fix: Don't try to close the control connection if it never got opened. (
Browse files Browse the repository at this point in the history
esnet#1136)

This prevents an "undefined socket" error, which can be incorrect if
the control connection didn't get opened due to a (for example)
"connection refused" type error.

This can be tested by running iperf3 in client mode and pointing it
towards a non-existent (or not-running) server.

Fixes esnet#1129 (esnet#1132 was an earlier, partial fix).
  • Loading branch information
bmah888 authored and hanvari committed Jul 3, 2021
1 parent 931dfab commit 99d598d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/iperf_client_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ iperf_client_end(struct iperf_test *test)
return -1;

/* Close control socket */
if (test->ctrl_sck)
if (test->ctrl_sck >= 0)
close(test->ctrl_sck);

return 0;
Expand Down

0 comments on commit 99d598d

Please sign in to comment.