From: LRN Date: Fri, 13 Jul 2012 16:24:27 +0000 (+0000) Subject: Safer handling of corner-cases in w32 select X-Git-Tag: initial-import-from-subversion-38251~12518 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1e30a9c42a35e67efd684e7a5455858fa72775ee;p=oweals%2Fgnunet.git Safer handling of corner-cases in w32 select --- diff --git a/src/util/network.c b/src/util/network.c index c61704be9..6d8b2869a 100644 --- a/src/util/network.c +++ b/src/util/network.c @@ -1523,10 +1523,22 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, LOG (GNUNET_ERROR_TYPE_DEBUG, "nfds: %d, handles: %d, will wait: %llu ms\n", nfds, nhandles, (unsigned long long) ms_total); if (nhandles) + { returncode = WaitForMultipleObjects (nhandles, handle_array, FALSE, ms_total); - LOG (GNUNET_ERROR_TYPE_DEBUG, "WaitForMultipleObjects Returned : %d\n", - returncode); + LOG (GNUNET_ERROR_TYPE_DEBUG, "WaitForMultipleObjects Returned : %d\n", + returncode); + } + else if (nfds > 0) + { + i = (int) WaitForSingleObject (select_finished_event, INFINITE); + returncode = WAIT_TIMEOUT; + } + else + { + /* Shouldn't come this far. If it does - investigate. */ + GNUNET_assert (0); + } if (nfds > 0) {