-fix off-by-1
[oweals/gnunet.git] / src / dht / gnunet-service-dht_neighbours.c
index d82effb3433710c3066eff648442819639afc48b..773ad8983c0748ad052ae774055615c78369bf50 100644 (file)
@@ -712,12 +712,8 @@ send_find_peer_message (void *cls)
   struct GNUNET_TIME_Relative next_send_time;
   struct BloomConstructorContext bcc;
   struct GNUNET_CONTAINER_BloomFilter *peer_bf;
-  const struct GNUNET_SCHEDULER_TaskContext *tc;
 
   find_peer_task = NULL;
-  tc = GNUNET_SCHEDULER_get_task_context ();
-  if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
-    return;
   if (newly_found_peers > bucket_size)
   {
     /* If we are finding many peers already, no need to send out our request right now! */
@@ -756,8 +752,10 @@ send_find_peer_message (void *cls)
                                 DHT_MAXIMUM_FIND_PEER_INTERVAL.rel_value_us /
                                 (newly_found_peers + 1));
   newly_found_peers = 0;
+  GNUNET_assert (NULL == find_peer_task);
   find_peer_task =
-      GNUNET_SCHEDULER_add_delayed (next_send_time, &send_find_peer_message,
+      GNUNET_SCHEDULER_add_delayed (next_send_time,
+                                    &send_find_peer_message,
                                     NULL);
 }
 
@@ -825,6 +823,7 @@ handle_core_connect (void *cls,
       (GNUNET_YES != disable_try_connect))
   {
     /* got a first connection, good time to start with FIND PEER requests... */
+    GNUNET_assert (NULL == find_peer_task);
     find_peer_task = GNUNET_SCHEDULER_add_now (&send_find_peer_message,
                                                NULL);
   }
@@ -2443,6 +2442,7 @@ GDS_NEIGHBOURS_done ()
   }
 }
 
+
 /**
  * Get the ID of the local node.
  *