From 29a709d0e669fcf0b3ba12fe489c469ce69fc7f2 Mon Sep 17 00:00:00 2001 From: David Bar-On <61089727+davidBar-On@users.noreply.github.com> Date: Fri, 4 Dec 2020 18:19:08 +0200 Subject: [PATCH] Closing server prot_listener socket after stream setup failure (#1084) Making sure the server closes prot_listener socket at the end of a session with a client. Without this change the socket may remain open, for example when there is a failure during the UDP stream establishment because the --window value is too high. Closing the socket was added to cleanup_server() as it seems to handle all cases where the socket may remain open. --- src/iperf_server_api.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index 335eb8076..83b91ecd9 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -377,6 +377,9 @@ cleanup_server(struct iperf_test *test) if (test->listener) { close(test->listener); } + if (test->prot_listener > -1) { // May remain open if create socket failed + close(test->prot_listener); + } /* Cancel any remaining timers. */ if (test->stats_timer != NULL) {