catch early return of select before call to GNUNET_SCHEDULER_run_from_driver
authorlurchi <lurchi@strangeplace.net>
Tue, 23 Jan 2018 08:09:27 +0000 (09:09 +0100)
committerlurchi <lurchi@strangeplace.net>
Tue, 23 Jan 2018 08:09:27 +0000 (09:09 +0100)
src/util/scheduler.c

index 6a1b1a22d83b5d327576487070ec92fa1ccaf0c9..a8d572a56f6578a390b8db669e914325c9527d5c 100644 (file)
@@ -25,6 +25,8 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "disk.h"
+// DEBUG
+#include <inttypes.h>
 
 #define LOG(kind,...) GNUNET_log_from (kind, "util-scheduler", __VA_ARGS__)
 
@@ -2333,6 +2335,19 @@ select_loop (void *cls,
         }
       }
     }
+    else
+    {
+      struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+      if (now.abs_value_us < context->timeout.abs_value_us)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    "select was expected to return at %" PRIu64 ", "
+                    "but returned already at %" PRIu64 "\n",
+                    context->timeout.abs_value_us,
+                    now.abs_value_us);
+        GNUNET_assert (0);
+      }
+    }
     tasks_ready = GNUNET_SCHEDULER_run_from_driver (sh);
     GNUNET_assert (GNUNET_SYSERR != tasks_ready);
   }