struct PeerInfo *prev;
/**
- * Count of outstanding messages for peer.
+ * Count of outstanding messages for peer.
*/
unsigned int pending_count;
/**
* Handle to CORE.
*/
-static struct GNUNET_CORE_Handle *coreAPI;
+static struct GNUNET_CORE_Handle *core_api;
/**
* Handle to ATS.
* @return #GNUNET_YES (we should continue to iterate)
*/
static int
-add_known_to_bloom (void *cls,
- const struct GNUNET_PeerIdentity *key,
+add_known_to_bloom (void *cls,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct BloomConstructorContext *ctx = cls;
/* Check for connect to self message */
if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity)))
return;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Connected to %s\n",
GNUNET_i2s (peer));
if (GNUNET_YES ==
&phash);
peer_bucket = find_bucket (&phash);
GNUNET_assert ((peer_bucket >= 0) && (peer_bucket < MAX_BUCKETS));
- ret = GNUNET_malloc (sizeof (struct PeerInfo));
+ ret = GNUNET_new (struct PeerInfo);
#if 0
ret->latency = latency;
ret->distance = distance;
/* Check for disconnect from self message */
if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity)))
return;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Disconnected %s\n",
GNUNET_i2s (peer));
to_remove =
if (buf == NULL)
{
peer->th =
- GNUNET_CORE_notify_transmit_ready (coreAPI, GNUNET_NO,
+ GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO,
pending->importance,
GNUNET_TIME_absolute_get_remaining
(pending->timeout), &peer->id,
if (peer->head != NULL)
{
peer->th =
- GNUNET_CORE_notify_transmit_ready (coreAPI, GNUNET_NO,
+ GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO,
pending->importance,
GNUNET_TIME_absolute_get_remaining
(pending->timeout), &peer->id, msize,
("# Bytes of bandwidth requested from core"),
ntohs (pending->msg->size), GNUNET_NO);
peer->th =
- GNUNET_CORE_notify_transmit_ready (coreAPI, GNUNET_NO,
+ GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO,
pending->importance,
GNUNET_TIME_absolute_get_remaining
(pending->timeout), &peer->id,
* Differences in the lower bits must count stronger than differences
* in the higher bits.
*
- * @param target
+ * @param target
* @param have
* @return 0 if have==target, otherwise a number
* that is larger as the distance between
* the two hash codes increases
*/
static unsigned int
-get_distance (const struct GNUNET_HashCode *target,
+get_distance (const struct GNUNET_HashCode *target,
const struct GNUNET_HashCode *have)
{
unsigned int bucket;
struct GNUNET_HashCode nhash;
GNUNET_assert (NULL != bloom);
- ret = get_forward_count (hop_count, target_replication);
+ ret = get_forward_count (hop_count, target_replication);
if (0 == ret)
{
*targets = NULL;
*targets = rtargets;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Forwarding query `%s' to %u peers (goal was %u peers)\n",
- GNUNET_h2s (key),
+ GNUNET_h2s (key),
off,
ret);
return off;
* #GNUNET_SYSERR to close it (signal serious error)
*/
static int
-handle_dht_p2p_put (void *cls,
+handle_dht_p2p_put (void *cls,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message)
{
tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
- "XDHT PUT %s: %s->%s (%u, %u=>%u)\n",
+ "XDHT PUT %s: %s->%s (%u, %u=>%u)\n",
GNUNET_h2s (&put->key), GNUNET_i2s (peer), tmp,
ntohl(put->hop_count),
GNUNET_CRYPTO_hash_matching_bits (&phash, &put->key),
tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
- "XDHT GET %s: %s->%s (%u, %u=>%u) xq: %.*s\n",
+ "XDHT GET %s: %s->%s (%u, %u=>%u) xq: %.*s\n",
GNUNET_h2s (&get->key), GNUNET_i2s (peer), tmp,
ntohl(get->hop_count),
GNUNET_CRYPTO_hash_matching_bits (&phash, &get->key),
char *tmp;
tmp = GNUNET_strdup (GNUNET_i2s (&my_identity));
- LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, "XDHT RESULT %s: %s->%s (%u)\n",
+ LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, "XDHT RESULT %s: %s->%s (%u)\n",
GNUNET_h2s (&prm->key), GNUNET_i2s (peer), tmp,
get_path_length + 1);
GNUNET_free (tmp);
struct GNUNET_PeerIdentity xput_path[get_path_length + 1 + put_path_length];
memcpy (xput_path, put_path, put_path_length * sizeof (struct GNUNET_PeerIdentity));
- memcpy (&xput_path[put_path_length],
- xget_path,
+ memcpy (&xput_path[put_path_length],
+ xget_path,
get_path_length * sizeof (struct GNUNET_PeerIdentity));
-
+
GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (prm->expiration_time),
&prm->key,
get_path_length + put_path_length, xput_path,
log_route_details_stderr =
(NULL != getenv("GNUNET_DHT_ROUTE_DEBUG")) ? GNUNET_YES : GNUNET_NO;
atsAPI = GNUNET_ATS_performance_init (GDS_cfg, NULL, NULL);
- coreAPI =
+ core_api =
GNUNET_CORE_connect (GDS_cfg, NULL, &core_init, &handle_core_connect,
&handle_core_disconnect, NULL, GNUNET_NO, NULL,
GNUNET_NO, core_handlers);
- if (coreAPI == NULL)
+ if (core_api == NULL)
return GNUNET_SYSERR;
all_known_peers = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO);
return GNUNET_OK;
void
GDS_NEIGHBOURS_done ()
{
- if (NULL == coreAPI)
+ if (NULL == core_api)
return;
- GNUNET_CORE_disconnect (coreAPI);
- coreAPI = NULL;
+ GNUNET_CORE_disconnect (core_api);
+ core_api = NULL;
GNUNET_ATS_performance_done (atsAPI);
atsAPI = NULL;
GNUNET_assert (0 == GNUNET_CONTAINER_multipeermap_size (all_known_peers));
/**
* Get the ID of the local node.
- *
+ *
* @return identity of the local node
*/
struct GNUNET_PeerIdentity *