aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-05-07 07:33:14 +0000
committerChristian Grothoff <christian@grothoff.org>2011-05-07 07:33:14 +0000
commitd528ac0433da5d9e5c7a5518ac90c4669a421152 (patch)
treef3bfd42cad436121a926c9773e3c458674e496d7 /src/dht/gnunet-service-dht.c
parent87617678ba742a1daf222858117e53252e3f0f11 (diff)
downloadgnunet-d528ac0433da5d9e5c7a5518ac90c4669a421152.tar.gz
gnunet-d528ac0433da5d9e5c7a5518ac90c4669a421152.zip
clean up
Diffstat (limited to 'src/dht/gnunet-service-dht.c')
-rw-r--r--src/dht/gnunet-service-dht.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index 1e826096c..630c6a35b 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -2154,8 +2154,9 @@ route_result_message (struct GNUNET_MessageHeader *msg,
2154 struct DHTRouteSource *pos; 2154 struct DHTRouteSource *pos;
2155 struct PeerInfo *peer_info; 2155 struct PeerInfo *peer_info;
2156 const struct GNUNET_MessageHeader *hello_msg; 2156 const struct GNUNET_MessageHeader *hello_msg;
2157#if DEBUG_DHT > 1
2157 unsigned int i; 2158 unsigned int i;
2158 char *path_offset; 2159#endif
2159 2160
2160 increment_stats (STAT_RESULTS); 2161 increment_stats (STAT_RESULTS);
2161 /** 2162 /**
@@ -2271,14 +2272,18 @@ route_result_message (struct GNUNET_MessageHeader *msg,
2271 increment_stats (STAT_RESULTS_TO_CLIENT); 2272 increment_stats (STAT_RESULTS_TO_CLIENT);
2272 if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_DHT_GET_RESULT) 2273 if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_DHT_GET_RESULT)
2273 increment_stats (STAT_GET_REPLY); 2274 increment_stats (STAT_GET_REPLY);
2274 2275#if DEBUG_DHT > 1
2275 for (i = 0; i < msg_ctx->path_history_len; i++) 2276 for (i = 0; i < msg_ctx->path_history_len; i++)
2276 { 2277 {
2278 char *path_offset;
2279
2277 path_offset = &msg_ctx->path_history[i * sizeof(struct GNUNET_PeerIdentity)]; 2280 path_offset = &msg_ctx->path_history[i * sizeof(struct GNUNET_PeerIdentity)];
2278#if DEBUG_DHT > 1 2281 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2279 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "(before client) Key %s Found peer %d:%s\n", GNUNET_h2s(&msg_ctx->key), i, GNUNET_i2s((struct GNUNET_PeerIdentity *)path_offset)); 2282 "(before client) Key %s Found peer %d:%s\n",
2280#endif 2283 GNUNET_h2s(&msg_ctx->key), i,
2284 GNUNET_i2s((struct GNUNET_PeerIdentity *)path_offset));
2281 } 2285 }
2286#endif
2282 send_reply_to_client (pos->client, msg, msg_ctx); 2287 send_reply_to_client (pos->client, msg, msg_ctx);
2283 } 2288 }
2284 else /* Send to peer */ 2289 else /* Send to peer */
@@ -3382,7 +3387,6 @@ select_peer (const GNUNET_HashCode * target,
3382 unsigned int i; 3387 unsigned int i;
3383 unsigned int count; 3388 unsigned int count;
3384 unsigned int offset; 3389 unsigned int offset;
3385 unsigned int my_matching_bits;
3386 int closest_bucket; 3390 int closest_bucket;
3387 struct PeerInfo *pos; 3391 struct PeerInfo *pos;
3388 struct PeerInfo *sorted_closest[bucket_size]; 3392 struct PeerInfo *sorted_closest[bucket_size];
@@ -3398,9 +3402,6 @@ select_peer (const GNUNET_HashCode * target,
3398 unsigned int largest_distance; 3402 unsigned int largest_distance;
3399 struct PeerInfo *chosen; 3403 struct PeerInfo *chosen;
3400 3404
3401 my_matching_bits =
3402 GNUNET_CRYPTO_hash_matching_bits (target, &my_identity.hashPubKey);
3403
3404 total_distance = 0; 3405 total_distance = 0;
3405 /** If we are doing kademlia routing, or converge is binary (saves some cycles) */ 3406 /** If we are doing kademlia routing, or converge is binary (saves some cycles) */
3406 if ((strict_kademlia == GNUNET_YES) || 3407 if ((strict_kademlia == GNUNET_YES) ||