dont try to send to more peers that exist
authorNathan S. Evans <evans@in.tum.de>
Fri, 19 Nov 2010 10:09:22 +0000 (10:09 +0000)
committerNathan S. Evans <evans@in.tum.de>
Fri, 19 Nov 2010 10:09:22 +0000 (10:09 +0000)
src/dht/gnunet-dht-driver.c

index 7f2447c1301e005d524ff44359cff4f94354306e..47493c256ebb44e0b48f77ee14ff897627508de0 100644 (file)
@@ -2014,8 +2014,8 @@ schedule_find_peer_requests (void *cls, const struct GNUNET_SCHEDULER_TaskContex
   if (find_peer_ctx->total > max_outstanding_find_peers)
     find_peer_ctx->total = max_outstanding_find_peers;
 
-  if (find_peer_ctx->total > GNUNET_CONTAINER_heap_get_size(find_peer_ctx->peer_min_heap)) /* Don't try to send more messages than we have peers! */
-    find_peer_ctx->total = GNUNET_CONTAINER_heap_get_size(find_peer_ctx->peer_min_heap);
+  if (find_peer_ctx->total > num_peers) /* Don't try to send more messages than we have peers! */
+    find_peer_ctx->total = num_peers;
 
   find_peer_ctx->last_sent = find_peer_ctx->total;
   GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Sending %u find peer messages (goal at least %u connections)\n", find_peer_ctx->total, connection_estimate(num_peers, DEFAULT_BUCKET_SIZE));