fix behaviour of GNUNET_SCHEDULER_add_select on empty fdsets
authorlurchi <lurchi@strangeplace.net>
Thu, 24 Aug 2017 20:17:46 +0000 (22:17 +0200)
committerlurchi <lurchi@strangeplace.net>
Thu, 24 Aug 2017 20:17:46 +0000 (22:17 +0200)
if GNUNET_SCHEDULER_add_select is called with empty fdsets, the
    resulting task is now added to the pending_timeout queue instead of
    the pending queue. This way the driver will not know about the task.

src/util/scheduler.c

index 51833a78b8d39001f38a86a6136a848ea21f3a4f..cbb48c3a435195201f10f920c4e9724e0a8751d1 100644 (file)
@@ -1717,8 +1717,7 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
   unsigned int read_nhandles_len, write_nhandles_len,
                read_fhandles_len, write_fhandles_len;
 
-  if ( (NULL == rs) &&
-       (NULL == ws) )
+  if (((NULL == rs) && (NULL == ws)) || ((0 == rs->nsds) && (0 == ws->nsds)))
     return GNUNET_SCHEDULER_add_delayed_with_priority (delay,
                                                        prio,
                                                        task,
@@ -1759,7 +1758,6 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
                      &write_fhandles,
                      &write_fhandles_len);
   }
-  GNUNET_assert (read_nhandles_len + write_nhandles_len > 0);
   init_fd_info (t,
                 read_nhandles,
                 read_nhandles_len,