static struct GNUNET_CORE_Handle *coreAPI;
+
/**
* Find the optimal bucket for this key.
*
GNUNET_break (0);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Peer `%s' connected!\n",
- GNUNET_i2s (peer));
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# Peers connected"), 1,
GNUNET_NO);
GNUNET_break (0);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Peer `%s' disconnected!\n",
- GNUNET_i2s (peer));
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# Peers connected"), -1,
GNUNET_NO);
/* greedy selection (closest peer that is not in bloomfilter) */
smallest_distance = UINT_MAX;
chosen = NULL;
- for (bc = closest_bucket; bc < MAX_BUCKETS; bc++)
+ for (bc = 0; bc < closest_bucket; bc++)
{
pos = k_buckets[bc].head;
count = 0;
return 0;
}
rtargets = GNUNET_malloc (sizeof (struct PeerInfo*) * ret);
- off = 0;
- while (ret-- > 0)
+ for (off = 0; off < ret; off++)
{
nxt = select_peer (key, bloom, hop_count);
if (nxt == NULL)
break;
- rtargets[off++] = nxt;
+ rtargets[off] = nxt;
GNUNET_break (GNUNET_NO ==
GNUNET_CONTAINER_bloomfilter_test (bloom, &nxt->id.hashPubKey));
GNUNET_CONTAINER_bloomfilter_add (bloom, &nxt->id.hashPubKey);
&targets);
if (0 == target_count)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Not forwarding PUT for `%s' after %u hops (NSE: %f)!\n",
- GNUNET_h2s (key),
- hop_count,
- GDS_NSE_get());
return;
}
msize = put_path_length * sizeof (struct GNUNET_PeerIdentity) + data_size + sizeof (struct PeerPutMessage);
&targets);
if (0 == target_count)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Not forwarding GET for `%s' after %u hops!\n",
- GNUNET_h2s (key),
- hop_count);
return;
}
reply_bf_size = GNUNET_CONTAINER_bloomfilter_get_size (reply_bf);
if (NULL == pi)
{
/* peer disconnected in the meantime, drop reply */
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Not forwarding REPLY for `%s' due to predecessor disconnect\n",
- GNUNET_h2s (key));
return;
}
GNUNET_STATISTICS_update (GDS_stats,
{
GNUNET_assert (peer != NULL);
peer = peer->next;
+ choice--;
}
choice = bucket->peers_size;
do