From 1e30a9c42a35e67efd684e7a5455858fa72775ee Mon Sep 17 00:00:00 2001 From: LRN Date: Fri, 13 Jul 2012 16:24:27 +0000 Subject: [PATCH] Safer handling of corner-cases in w32 select --- src/util/network.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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) { -- 2.25.1