1
1

Prevent a double-close on the server side in some cases.

Alternate solution to a problem pointed out by @g-coder in pull request #429.
Этот коммит содержится в:
Bruce A. Mah 2016-09-21 11:25:18 -07:00
родитель 93c498d417
Коммит 03340fe595
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4984910A8CAAEE8A

Просмотреть файл

@ -1,5 +1,5 @@
/*
* iperf, Copyright (c) 2014, 2015, The Regents of the University of
* iperf, Copyright (c) 2014, 2015, 2016, The Regents of the University of
* California, through Lawrence Berkeley National Laboratory (subject
* to receipt of any required approvals from the U.S. Dept. of
* Energy). All rights reserved.
@ -410,8 +410,12 @@ static void
cleanup_server(struct iperf_test *test)
{
/* Close open test sockets */
if (test->ctrl_sck) {
close(test->ctrl_sck);
}
if (test->listener) {
close(test->listener);
}
/* Cancel any remaining timers. */
if (test->stats_timer != NULL) {
@ -545,6 +549,7 @@ iperf_run_server(struct iperf_test *test)
if (test->no_delay || test->settings->mss || test->settings->socket_bufsize) {
FD_CLR(test->listener, &test->read_set);
close(test->listener);
test->listener = 0;
if ((s = netannounce(test->settings->domain, Ptcp, test->bind_address, test->server_port)) < 0) {
cleanup_server(test);
i_errno = IELISTEN;