From fcd40dcd667f5f173c5f810c2cc196942ac8142c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 2 Oct 2009 12:52:50 +0000 Subject: [PATCH] detect hanging select --- src/util/network.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/util/network.c b/src/util/network.c index 2deb0261c..f2c1faa4b 100644 --- a/src/util/network.c +++ b/src/util/network.c @@ -643,6 +643,14 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, tv.tv_sec = timeout.value / GNUNET_TIME_UNIT_SECONDS.value; tv.tv_usec = 1000 * (timeout.value - (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.value)); + if ( (nfds == 0) && + (timeout.value == GNUNET_TIME_UNIT_FOREVER_REL.value) ) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n"), + "select"); + GNUNET_break (0); + } return select (nfds + 1, (rfds != NULL) ? &rfds->sds : NULL, (wfds != NULL) ? &wfds->sds : NULL, -- 2.25.1