#include "dht.h"
#include <fenv.h>
-#define EXTRA_CHECKS GNUNET_NO
/**
* How many buckets will we allow total.
return actual_bucket;
}
-#if EXTRA_CHECKS
-/**
- * Find a routing table entry from a peer identity
- *
- * @param peer the peer to look up
- *
- * @return the bucket number holding the peer, GNUNET_SYSERR if not found
- */
-static int
-find_bucket_by_peer (const struct PeerInfo *peer)
-{
- int bucket;
- struct PeerInfo *pos;
-
- for (bucket = lowest_bucket; bucket < MAX_BUCKETS - 1; bucket++)
- {
- pos = k_buckets[bucket].head;
- while (pos != NULL)
- {
- if (peer == pos)
- return bucket;
- pos = pos->next;
- }
- }
-
- return GNUNET_SYSERR; /* No such peer. */
-}
-#endif
-
/**
* Find a routing table entry from a peer identity
struct P2PPendingMessage *pos;
struct P2PPendingMessage *next;
-#if EXTRA_CHECKS
- struct PeerInfo *peer_pos;
-
- peer_pos = k_buckets[bucket].head;
- while ((peer_pos != NULL) && (peer_pos != peer))
- peer_pos = peer_pos->next;
- if (peer_pos == NULL)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "%s:%s: Expected peer `%s' in bucket %d\n", my_short_id, "DHT",
- GNUNET_i2s (&peer->id), bucket);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "%s:%s: Lowest bucket: %d, find_current_bucket: %d, peer resides in bucket: %d\n",
- my_short_id, "DHT", lowest_bucket,
- find_current_bucket (&peer->id.hashPubKey),
- find_bucket_by_peer (peer));
- }
- GNUNET_assert (peer_pos != NULL);
-#endif
remove_peer (peer, bucket); /* First remove the peer from its bucket */
-
if (peer->send_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (peer->send_task);
if ((peer->th != NULL) && (coreAPI != NULL))
char *route_path;
int path_size;
- if (ntohs (enc_msg->type) == GNUNET_MESSAGE_TYPE_DHT_P2P_PING)
- {
- /* Throw these away. FIXME: Don't throw these away? (reply) */
-#if DEBUG_PING
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s:%s Received P2P Ping message.\n",
- my_short_id, "DHT");
-#endif
- return GNUNET_YES;
- }
-
if (ntohs (enc_msg->size) >= GNUNET_SERVER_MAX_MESSAGE_SIZE - 1)
{
GNUNET_break_op (0);