aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2011-02-11 13:59:03 +0000
committerNathan S. Evans <evans@in.tum.de>2011-02-11 13:59:03 +0000
commit5bc01eca77a685f63ac94129ee0eea0140beaf76 (patch)
tree1d9657e80e828d26bb3de92e548206eb0b2bd701 /src/dht
parentcf31c88fa64fb9bbe02478cf5adc179af4e9d725 (diff)
downloadgnunet-5bc01eca77a685f63ac94129ee0eea0140beaf76.tar.gz
gnunet-5bc01eca77a685f63ac94129ee0eea0140beaf76.zip
reduce logging under normal (non-debugging) circumstances
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/gnunet-service-dht.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index bb7b74404..c2049a8e9 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -750,6 +750,12 @@ static unsigned int do_republish;
750static unsigned int paper_forwarding; 750static unsigned int paper_forwarding;
751 751
752/** 752/**
753 * PUT Peer Identities of peers we know about into
754 * the datacache.
755 */
756static unsigned int put_peer_identities;
757
758/**
753 * Use the "real" distance metric when selecting the 759 * Use the "real" distance metric when selecting the
754 * next routing hop. Can be less accurate. 760 * next routing hop. Can be less accurate.
755 */ 761 */
@@ -1021,10 +1027,11 @@ get_max_send_delay ()
1021 if (reply_times[i].rel_value > max_time.rel_value) 1027 if (reply_times[i].rel_value > max_time.rel_value)
1022 max_time.rel_value = reply_times[i].rel_value; 1028 max_time.rel_value = reply_times[i].rel_value;
1023 } 1029 }
1024 1030#if DEBUG_DHT
1025 if (max_time.rel_value > MAX_REQUEST_TIME.rel_value) 1031 if (max_time.rel_value > MAX_REQUEST_TIME.rel_value)
1026 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Max send delay was %llu\n", 1032 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Max send delay was %llu\n",
1027 (unsigned long long) max_time.rel_value); 1033 (unsigned long long) max_time.rel_value);
1034#endif
1028 return max_time; 1035 return max_time;
1029} 1036}
1030 1037
@@ -1487,9 +1494,11 @@ update_core_preference (void *cls,
1487 &peer->id.hashPubKey); 1494 &peer->id.hashPubKey);
1488 if (matching >= 64) 1495 if (matching >= 64)
1489 { 1496 {
1497#if DEBUG_DHT
1490 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1498 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1491 "Peer identifier matches by %u bits, only shifting as much as we can!\n", 1499 "Peer identifier matches by %u bits, only shifting as much as we can!\n",
1492 matching); 1500 matching);
1501#endif
1493 matching = 63; 1502 matching = 63;
1494 } 1503 }
1495 preference = 1LL << matching; 1504 preference = 1LL << matching;
@@ -2260,7 +2269,9 @@ route_result_message (struct GNUNET_MessageHeader *msg,
2260 for (i = 0; i < msg_ctx->path_history_len; i++) 2269 for (i = 0; i < msg_ctx->path_history_len; i++)
2261 { 2270 {
2262 path_offset = &msg_ctx->path_history[i * sizeof(struct GNUNET_PeerIdentity)]; 2271 path_offset = &msg_ctx->path_history[i * sizeof(struct GNUNET_PeerIdentity)];
2272#if DEBUG_DHT > 1
2263 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)); 2273 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));
2274#endif
2264 } 2275 }
2265 send_reply_to_client (pos->client, msg, msg_ctx); 2276 send_reply_to_client (pos->client, msg, msg_ctx);
2266 } 2277 }
@@ -2776,9 +2787,11 @@ handle_dht_find_peer (const struct GNUNET_MessageHeader *find_msg,
2776 &msg_ctx->key, NULL, 2787 &msg_ctx->key, NULL,
2777 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) 2788 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
2778 { 2789 {
2790#if DEBUG_DHT
2779 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2791 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2780 "Adding recent remove task for key `%s`!\n", 2792 "Adding recent remove task for key `%s`!\n",
2781 GNUNET_h2s (&msg_ctx->key)); 2793 GNUNET_h2s (&msg_ctx->key));
2794#endif
2782 /* Only add a task if there wasn't one for this key already! */ 2795 /* Only add a task if there wasn't one for this key already! */
2783 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 2796 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
2784 (GNUNET_TIME_UNIT_SECONDS, 30), 2797 (GNUNET_TIME_UNIT_SECONDS, 30),
@@ -2787,8 +2800,10 @@ handle_dht_find_peer (const struct GNUNET_MessageHeader *find_msg,
2787 else 2800 else
2788 { 2801 {
2789 GNUNET_free (recent_hash); 2802 GNUNET_free (recent_hash);
2803#if DEBUG_DHT
2790 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2804 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2791 "Received duplicate find peer request too soon!\n"); 2805 "Received duplicate find peer request too soon!\n");
2806#endif
2792 } 2807 }
2793 2808
2794 /* Simplistic find_peer functionality, always return our hello */ 2809 /* Simplistic find_peer functionality, always return our hello */
@@ -2806,10 +2821,11 @@ handle_dht_find_peer (const struct GNUNET_MessageHeader *find_msg,
2806 find_peer_result->type = htons (GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_RESULT); 2821 find_peer_result->type = htons (GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_RESULT);
2807 find_peer_result->size = htons (tsize); 2822 find_peer_result->size = htons (tsize);
2808 memcpy (&find_peer_result[1], my_hello, hello_size); 2823 memcpy (&find_peer_result[1], my_hello, hello_size);
2809 2824#if DEBUG_DHT
2810 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2825 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2811 "`%s': Sending hello size %d to requesting peer.\n", 2826 "`%s': Sending hello size %d to requesting peer.\n",
2812 "DHT", hello_size); 2827 "DHT", hello_size);
2828#endif
2813 2829
2814 new_msg_ctx = GNUNET_malloc (sizeof (struct DHT_MessageContext)); 2830 new_msg_ctx = GNUNET_malloc (sizeof (struct DHT_MessageContext));
2815 memcpy (new_msg_ctx, msg_ctx, sizeof (struct DHT_MessageContext)); 2831 memcpy (new_msg_ctx, msg_ctx, sizeof (struct DHT_MessageContext));
@@ -5180,13 +5196,15 @@ handle_core_connect (void *cls,
5180 GNUNET_CONTAINER_multihashmap_contains (all_known_peers, 5196 GNUNET_CONTAINER_multihashmap_contains (all_known_peers,
5181 &peer->hashPubKey)) 5197 &peer->hashPubKey))
5182 { 5198 {
5199#if DEBUG_DHT
5183 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 5200 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5184 "%s:%s Received %s message for peer %s, but already have peer in RT!", 5201 "%s:%s Received %s message for peer %s, but already have peer in RT!",
5185 my_short_id, "DHT", "CORE CONNECT", GNUNET_i2s (peer)); 5202 my_short_id, "DHT", "CORE CONNECT", GNUNET_i2s (peer));
5203#endif
5186 return; 5204 return;
5187 } 5205 }
5188 5206
5189 if (datacache != NULL) 5207 if ((datacache != NULL) && (GNUNET_YES == put_peer_identities))
5190 { 5208 {
5191 put_entry = GNUNET_malloc(sizeof(struct DHTPutEntry) + sizeof (struct GNUNET_PeerIdentity)); 5209 put_entry = GNUNET_malloc(sizeof(struct DHTPutEntry) + sizeof (struct GNUNET_PeerIdentity));
5192 put_entry->path_length = 0; 5210 put_entry->path_length = 0;
@@ -5230,18 +5248,21 @@ handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
5230 /* Check for disconnect from self message */ 5248 /* Check for disconnect from self message */
5231 if (0 == memcmp(&my_identity, peer, sizeof(struct GNUNET_PeerIdentity))) 5249 if (0 == memcmp(&my_identity, peer, sizeof(struct GNUNET_PeerIdentity)))
5232 return; 5250 return;
5233 5251#if DEBUG_DHT
5234 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 5252 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5235 "%s:%s: Received peer disconnect message for peer `%s' from %s\n", 5253 "%s:%s: Received peer disconnect message for peer `%s' from %s\n",
5236 my_short_id, "DHT", GNUNET_i2s (peer), "CORE"); 5254 my_short_id, "DHT", GNUNET_i2s (peer), "CORE");
5255#endif
5237 5256
5238 if (GNUNET_YES != 5257 if (GNUNET_YES !=
5239 GNUNET_CONTAINER_multihashmap_contains (all_known_peers, 5258 GNUNET_CONTAINER_multihashmap_contains (all_known_peers,
5240 &peer->hashPubKey)) 5259 &peer->hashPubKey))
5241 { 5260 {
5261#if DEBUG_DHT
5242 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 5262 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5243 "%s:%s: do not have peer `%s' in RT, can't disconnect!\n", 5263 "%s:%s: do not have peer `%s' in RT, can't disconnect!\n",
5244 my_short_id, "DHT", GNUNET_i2s (peer)); 5264 my_short_id, "DHT", GNUNET_i2s (peer));
5265#endif
5245 return; 5266 return;
5246 } 5267 }
5247 increment_stats (STAT_DISCONNECTS); 5268 increment_stats (STAT_DISCONNECTS);
@@ -5479,6 +5500,10 @@ run (void *cls,
5479 GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", "paper_forwarding")) 5500 GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", "paper_forwarding"))
5480 paper_forwarding = GNUNET_YES; 5501 paper_forwarding = GNUNET_YES;
5481 5502
5503 if (GNUNET_YES ==
5504 GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", "put_peer_identities"))
5505 put_peer_identities = GNUNET_YES;
5506
5482 stats = GNUNET_STATISTICS_create ("dht", cfg); 5507 stats = GNUNET_STATISTICS_create ("dht", cfg);
5483 5508
5484 if (stats != NULL) 5509 if (stats != NULL)