{
struct ConnectInfo *ci = value;
+ (void) cls;
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multipeermap_remove (all_desired_peers,
peer,
const struct GNUNET_PeerIdentity *pid,
void *value)
{
- try_connect (pid, NULL);
+ (void) cls;
+ (void) value;
+ try_connect (pid,
+ NULL);
return GNUNET_YES;
}
struct GNUNET_BLOCK_Group *bg = cls;
struct GNUNET_HashCode key_hash;
+ (void) cls;
+ (void) value;
GNUNET_CRYPTO_hash (key,
sizeof (struct GNUNET_PeerIdentity),
&key_hash);
struct GNUNET_BLOCK_Group *bg;
struct GNUNET_CONTAINER_BloomFilter *peer_bf;
- find_peer_task = NULL;
+ (void) cls;
+ find_peer_task = NULL;
if (newly_found_peers > bucket_size)
{
/* If we are finding many peers already, no need to send out our request right now! */
{
struct PeerInfo *pi;
- /* Check for connect to self message */
+ (void) cls;
+ /* Check for connect to self message */
if (0 == memcmp (&my_identity,
peer,
sizeof (struct GNUNET_PeerIdentity)))
&pi->phash);
pi->peer_bucket = find_bucket (&pi->phash);
GNUNET_assert ( (pi->peer_bucket >= 0) &&
- (pi->peer_bucket < MAX_BUCKETS) );
+ ((unsigned int) pi->peer_bucket < MAX_BUCKETS) );
GNUNET_CONTAINER_DLL_insert_tail (k_buckets[pi->peer_bucket].head,
k_buckets[pi->peer_bucket].tail,
pi);
k_buckets[pi->peer_bucket].peers_size++;
closest_bucket = GNUNET_MAX (closest_bucket,
- pi->peer_bucket);
+ (unsigned int) pi->peer_bucket);
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multipeermap_put (all_connected_peers,
pi->id,
{
struct PeerInfo *to_remove = internal_cls;
+ (void) cls;
/* Check for disconnect from self message */
if (NULL == to_remove)
return;
int bits;
int other_bits;
int bucket_num;
- int count;
struct PeerInfo *pos;
- if (0 == memcmp (&my_identity_hash, key, sizeof (struct GNUNET_HashCode)))
+ if (0 == memcmp (&my_identity_hash,
+ key,
+ sizeof (struct GNUNET_HashCode)))
return GNUNET_YES;
bucket_num = find_bucket (key);
GNUNET_assert (bucket_num >= 0);
bits = GNUNET_CRYPTO_hash_matching_bits (&my_identity_hash,
key);
pos = k_buckets[bucket_num].head;
- count = 0;
- while ((NULL != pos) && (count < bucket_size))
+ while (NULL != pos)
{
- if ((NULL != bloom) &&
- (GNUNET_YES ==
- GNUNET_CONTAINER_bloomfilter_test (bloom,
- &pos->phash)))
+ if ( (NULL != bloom) &&
+ (GNUNET_YES ==
+ GNUNET_CONTAINER_bloomfilter_test (bloom,
+ &pos->phash)) )
{
pos = pos->next;
continue; /* Skip already checked entries */
core_init (void *cls,
const struct GNUNET_PeerIdentity *identity)
{
+ (void) cls;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"CORE called, I am %s\n",
GNUNET_i2s (identity));
uint32_t putlen;
uint16_t msize;
+ (void) cls;
msize = ntohs (put->header.size);
putlen = ntohl (put->put_path_length);
if ((msize <
struct GNUNET_CONTAINER_BloomFilter *bf;
struct GNUNET_HashCode test_key;
int forwarded;
+ struct GNUNET_TIME_Absolute exp_time;
+ exp_time = GNUNET_TIME_absolute_ntoh (put->expiration_time);
+ if (0 == GNUNET_TIME_absolute_get_remaining (exp_time).rel_value_us)
+ {
+ GNUNET_STATISTICS_update (GDS_stats,
+ gettext_noop ("# Expired PUTs discarded"),
+ 1,
+ GNUNET_NO);
+ return;
+ }
msize = ntohs (put->header.size);
putlen = ntohl (put->put_path_length);
GNUNET_STATISTICS_update (GDS_stats,
putlen = 0;
/* give to local clients */
- GDS_CLIENTS_handle_reply (GNUNET_TIME_absolute_ntoh (put->expiration_time),
+ GDS_CLIENTS_handle_reply (exp_time,
&put->key,
0,
NULL,
/* store locally */
if ((0 != (options & GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE)) ||
(GDS_am_closest_peer (&put->key, bf)))
- GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (put->expiration_time),
+ GDS_DATACACHE_handle_put (exp_time,
&put->key,
putlen,
pp,
forwarded = GDS_NEIGHBOURS_handle_put (ntohl (put->type),
options,
ntohl (put->desired_replication_level),
- GNUNET_TIME_absolute_ntoh (put->expiration_time),
+ exp_time,
ntohl (put->hop_count),
bf,
&put->key,
ntohl (put->hop_count),
ntohl (put->desired_replication_level),
putlen, pp,
- GNUNET_TIME_absolute_ntoh (put->expiration_time),
+ exp_time,
&put->key,
payload,
payload_size);
sizeof (struct GNUNET_HashCode)))
bucket_idx = closest_bucket;
else
- bucket_idx = GNUNET_MIN (closest_bucket,
+ bucket_idx = GNUNET_MIN ((int) closest_bucket,
find_bucket (key));
- if (bucket_idx == GNUNET_SYSERR)
+ if (bucket_idx < 0)
return;
bucket = &k_buckets[bucket_idx];
if (bucket->peers_size == 0)
uint32_t xquery_size;
uint16_t msize;
+ (void) cls;
msize = ntohs (get->header.size);
xquery_size = ntohl (get->xquery_size);
if (msize < sizeof (struct PeerGetMessage) + xquery_size)
uint32_t put_path_length;
uint16_t msize;
+ (void) cls;
msize = ntohs (prm->header.size);
put_path_length = ntohl (prm->put_path_length);
get_path_length = ntohl (prm->get_path_length);
uint16_t msize;
size_t data_size;
enum GNUNET_BLOCK_Type type;
+ struct GNUNET_TIME_Absolute exp_time;
/* parse and validate message */
+ exp_time = GNUNET_TIME_absolute_ntoh (prm->expiration_time);
+ if (0 == GNUNET_TIME_absolute_get_remaining (exp_time).rel_value_us)
+ {
+ GNUNET_STATISTICS_update (GDS_stats,
+ gettext_noop ("# Expired results discarded"),
+ 1,
+ GNUNET_NO);
+ return;
+ }
msize = ntohs (prm->header.size);
put_path_length = ntohl (prm->put_path_length);
get_path_length = ntohl (prm->get_path_length);
h);
}
-
/* First, check if 'peer' is already on the path, and if
so, truncate it instead of expanding. */
for (unsigned int i=0;i<=get_path_length;i++)
peer->id,
sizeof (struct GNUNET_PeerIdentity)))
{
- process_reply_with_path (GNUNET_TIME_absolute_ntoh (prm->expiration_time),
+ process_reply_with_path (exp_time,
&prm->key,
i,
get_path,
get_path_length * sizeof (struct GNUNET_PeerIdentity));
xget_path[get_path_length] = *peer->id;
- process_reply_with_path (GNUNET_TIME_absolute_ntoh (prm->expiration_time),
+ process_reply_with_path (exp_time,
&prm->key,
get_path_length + 1,
xget_path,