fix loop responsible for finding tasks with expired timeout
authorlurchi <lurchi@strangeplace.net>
Thu, 18 Jan 2018 15:25:10 +0000 (16:25 +0100)
committerlurchi <lurchi@strangeplace.net>
Thu, 18 Jan 2018 15:25:10 +0000 (16:25 +0100)
src/util/scheduler.c

index b262b14d7f49e9165427f037ea26e126d934648b..1e52dce9f0da4112302dbd20120804e6c1457bb1 100644 (file)
@@ -1885,8 +1885,10 @@ GNUNET_SCHEDULER_run_from_driver (struct GNUNET_SCHEDULER_Handle *sh)
 
   /* check for tasks that reached the timeout! */
   now = GNUNET_TIME_absolute_get ();
-  while (NULL != (pos = pending_timeout_head))
+  pos = pending_timeout_head;
+  while (NULL != pos)
   {
+    struct GNUNET_SCHEDULER_Task *next = pos->next;
     if (now.abs_value_us >= pos->timeout.abs_value_us)
       pos->reason |= GNUNET_SCHEDULER_REASON_TIMEOUT;
     if (0 == pos->reason)
@@ -1897,6 +1899,7 @@ GNUNET_SCHEDULER_run_from_driver (struct GNUNET_SCHEDULER_Handle *sh)
     if (pending_timeout_last == pos)
       pending_timeout_last = NULL;
     queue_ready_task (pos);
+    pos = next;
   }
   pos = pending_head;
   while (NULL != pos)