detect hanging select
authorChristian Grothoff <christian@grothoff.org>
Fri, 2 Oct 2009 12:52:50 +0000 (12:52 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 2 Oct 2009 12:52:50 +0000 (12:52 +0000)
src/util/network.c

index 2deb0261c91c8e2b74630fe9f5b59715f8ce231e..f2c1faa4b23d210414f67c39b950e01a37bb0780 100644 (file)
@@ -643,6 +643,14 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds,
 \r
   tv.tv_sec = timeout.value / GNUNET_TIME_UNIT_SECONDS.value;\r
   tv.tv_usec = 1000 * (timeout.value - (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.value));\r
+  if ( (nfds == 0) &&\r
+       (timeout.value == GNUNET_TIME_UNIT_FOREVER_REL.value) )\r
+    {\r
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,\r
+                 _("Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n"),\r
+                 "select");\r
+      GNUNET_break (0);\r
+    }\r
   return select (nfds + 1, \r
                 (rfds != NULL) ? &rfds->sds : NULL, \r
                 (wfds != NULL) ? &wfds->sds : NULL,\r