aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-13 11:58:47 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-13 11:58:47 +0000
commit40f1e01afae5598365adc9bf9542227166bddfd0 (patch)
tree15e94afe84959ca5658bbacaa9a50f65c8242cb2 /src/dht/gnunet-service-dht.c
parentebb34dfd2bf39750d1f125b73af41eea3ab156d4 (diff)
downloadgnunet-40f1e01afae5598365adc9bf9542227166bddfd0.tar.gz
gnunet-40f1e01afae5598365adc9bf9542227166bddfd0.zip
dce
Diffstat (limited to 'src/dht/gnunet-service-dht.c')
-rw-r--r--src/dht/gnunet-service-dht.c60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index 1b4d4f43a..8d85138cf 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -49,7 +49,6 @@
49#include "dht.h" 49#include "dht.h"
50#include <fenv.h> 50#include <fenv.h>
51 51
52#define EXTRA_CHECKS GNUNET_NO
53 52
54/** 53/**
55 * How many buckets will we allow total. 54 * How many buckets will we allow total.
@@ -1319,35 +1318,6 @@ find_current_bucket (const GNUNET_HashCode * hc)
1319 return actual_bucket; 1318 return actual_bucket;
1320} 1319}
1321 1320
1322#if EXTRA_CHECKS
1323/**
1324 * Find a routing table entry from a peer identity
1325 *
1326 * @param peer the peer to look up
1327 *
1328 * @return the bucket number holding the peer, GNUNET_SYSERR if not found
1329 */
1330static int
1331find_bucket_by_peer (const struct PeerInfo *peer)
1332{
1333 int bucket;
1334 struct PeerInfo *pos;
1335
1336 for (bucket = lowest_bucket; bucket < MAX_BUCKETS - 1; bucket++)
1337 {
1338 pos = k_buckets[bucket].head;
1339 while (pos != NULL)
1340 {
1341 if (peer == pos)
1342 return bucket;
1343 pos = pos->next;
1344 }
1345 }
1346
1347 return GNUNET_SYSERR; /* No such peer. */
1348}
1349#endif
1350
1351 1321
1352/** 1322/**
1353 * Find a routing table entry from a peer identity 1323 * Find a routing table entry from a peer identity
@@ -1481,27 +1451,7 @@ delete_peer (struct PeerInfo *peer, unsigned int bucket)
1481 struct P2PPendingMessage *pos; 1451 struct P2PPendingMessage *pos;
1482 struct P2PPendingMessage *next; 1452 struct P2PPendingMessage *next;
1483 1453
1484#if EXTRA_CHECKS
1485 struct PeerInfo *peer_pos;
1486
1487 peer_pos = k_buckets[bucket].head;
1488 while ((peer_pos != NULL) && (peer_pos != peer))
1489 peer_pos = peer_pos->next;
1490 if (peer_pos == NULL)
1491 {
1492 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1493 "%s:%s: Expected peer `%s' in bucket %d\n", my_short_id, "DHT",
1494 GNUNET_i2s (&peer->id), bucket);
1495 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1496 "%s:%s: Lowest bucket: %d, find_current_bucket: %d, peer resides in bucket: %d\n",
1497 my_short_id, "DHT", lowest_bucket,
1498 find_current_bucket (&peer->id.hashPubKey),
1499 find_bucket_by_peer (peer));
1500 }
1501 GNUNET_assert (peer_pos != NULL);
1502#endif
1503 remove_peer (peer, bucket); /* First remove the peer from its bucket */ 1454 remove_peer (peer, bucket); /* First remove the peer from its bucket */
1504
1505 if (peer->send_task != GNUNET_SCHEDULER_NO_TASK) 1455 if (peer->send_task != GNUNET_SCHEDULER_NO_TASK)
1506 GNUNET_SCHEDULER_cancel (peer->send_task); 1456 GNUNET_SCHEDULER_cancel (peer->send_task);
1507 if ((peer->th != NULL) && (coreAPI != NULL)) 1457 if ((peer->th != NULL) && (coreAPI != NULL))
@@ -4116,16 +4066,6 @@ handle_dht_p2p_route_request (void *cls, const struct GNUNET_PeerIdentity *peer,
4116 char *route_path; 4066 char *route_path;
4117 int path_size; 4067 int path_size;
4118 4068
4119 if (ntohs (enc_msg->type) == GNUNET_MESSAGE_TYPE_DHT_P2P_PING)
4120 {
4121 /* Throw these away. FIXME: Don't throw these away? (reply) */
4122#if DEBUG_PING
4123 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s:%s Received P2P Ping message.\n",
4124 my_short_id, "DHT");
4125#endif
4126 return GNUNET_YES;
4127 }
4128
4129 if (ntohs (enc_msg->size) >= GNUNET_SERVER_MAX_MESSAGE_SIZE - 1) 4069 if (ntohs (enc_msg->size) >= GNUNET_SERVER_MAX_MESSAGE_SIZE - 1)
4130 { 4070 {
4131 GNUNET_break_op (0); 4071 GNUNET_break_op (0);