aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-25 12:57:18 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-25 12:57:18 +0000
commit2e0897995fd89619b9da5050372239736bf87d68 (patch)
tree9f5c065393f55d503f19032a497bf25aa5daa6e1
parenta199124d5ffcea0dc0e99b550311d74c46b7f2b8 (diff)
downloadgnunet-2e0897995fd89619b9da5050372239736bf87d68.tar.gz
gnunet-2e0897995fd89619b9da5050372239736bf87d68.zip
put ifdefs around DEBUG logs
-rw-r--r--src/dht/dht_api.c20
-rw-r--r--src/dht/gnunet-service-dht.h2
-rw-r--r--src/dht/gnunet-service-dht_clients.c30
-rw-r--r--src/dht/gnunet-service-dht_datacache.c6
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c44
5 files changed, 92 insertions, 10 deletions
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c
index ee91c6f06..720e82a41 100644
--- a/src/dht/dht_api.c
+++ b/src/dht/dht_api.c
@@ -250,10 +250,12 @@ add_request_to_pending (void *cls, const GNUNET_HashCode * key, void *value)
250 250
251 if (GNUNET_NO == rh->message->in_pending_queue) 251 if (GNUNET_NO == rh->message->in_pending_queue)
252 { 252 {
253#if DEBUG_DHT
253 LOG (GNUNET_ERROR_TYPE_DEBUG, 254 LOG (GNUNET_ERROR_TYPE_DEBUG,
254 "Retransmitting request related to %s to DHT %p\n", 255 "Retransmitting request related to %s to DHT %p\n",
255 GNUNET_h2s (key), 256 GNUNET_h2s (key),
256 handle); 257 handle);
258#endif
257 GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail, 259 GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail,
258 rh->message); 260 rh->message);
259 rh->message->in_pending_queue = GNUNET_YES; 261 rh->message->in_pending_queue = GNUNET_YES;
@@ -281,9 +283,11 @@ try_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
281{ 283{
282 struct GNUNET_DHT_Handle *handle = cls; 284 struct GNUNET_DHT_Handle *handle = cls;
283 285
286#if DEBUG_DHT
284 LOG (GNUNET_ERROR_TYPE_DEBUG, 287 LOG (GNUNET_ERROR_TYPE_DEBUG,
285 "Reconnecting with DHT %p\n", 288 "Reconnecting with DHT %p\n",
286 handle); 289 handle);
290#endif
287 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 291 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
288 if (handle->retry_time.rel_value < GNUNET_CONSTANTS_SERVICE_RETRY.rel_value) 292 if (handle->retry_time.rel_value < GNUNET_CONSTANTS_SERVICE_RETRY.rel_value)
289 handle->retry_time = GNUNET_CONSTANTS_SERVICE_RETRY; 293 handle->retry_time = GNUNET_CONSTANTS_SERVICE_RETRY;
@@ -294,7 +298,9 @@ try_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
294 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 298 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
295 if (GNUNET_YES != try_connect (handle)) 299 if (GNUNET_YES != try_connect (handle))
296 { 300 {
301#if DEBUG_DHT
297 LOG (GNUNET_ERROR_TYPE_DEBUG, "dht reconnect failed(!)\n"); 302 LOG (GNUNET_ERROR_TYPE_DEBUG, "dht reconnect failed(!)\n");
303#endif
298 return; 304 return;
299 } 305 }
300 GNUNET_CONTAINER_multihashmap_iterate (handle->active_requests, 306 GNUNET_CONTAINER_multihashmap_iterate (handle->active_requests,
@@ -380,8 +386,10 @@ transmit_pending (void *cls, size_t size, void *buf)
380 handle->th = NULL; 386 handle->th = NULL;
381 if (buf == NULL) 387 if (buf == NULL)
382 { 388 {
389#if DEBUG_DHT
383 LOG (GNUNET_ERROR_TYPE_DEBUG, 390 LOG (GNUNET_ERROR_TYPE_DEBUG,
384 "Transmission to DHT service failed! Reconnecting!\n"); 391 "Transmission to DHT service failed! Reconnecting!\n");
392#endif
385 do_disconnect (handle); 393 do_disconnect (handle);
386 return 0; 394 return 0;
387 } 395 }
@@ -457,10 +465,12 @@ process_reply (void *cls, const GNUNET_HashCode * key, void *value)
457 if (dht_msg->unique_id != get_handle->unique_id) 465 if (dht_msg->unique_id != get_handle->unique_id)
458 { 466 {
459 /* UID mismatch */ 467 /* UID mismatch */
468#if DEBUG_DHT
460 LOG (GNUNET_ERROR_TYPE_DEBUG, 469 LOG (GNUNET_ERROR_TYPE_DEBUG,
461 "Ignoring reply for %s: UID mismatch: %llu/%llu\n", 470 "Ignoring reply for %s: UID mismatch: %llu/%llu\n",
462 GNUNET_h2s (key), 471 GNUNET_h2s (key),
463 dht_msg->unique_id, get_handle->unique_id); 472 dht_msg->unique_id, get_handle->unique_id);
473#endif
464 return GNUNET_YES; 474 return GNUNET_YES;
465 } 475 }
466 msize = ntohs (dht_msg->header.size); 476 msize = ntohs (dht_msg->header.size);
@@ -479,10 +489,12 @@ process_reply (void *cls, const GNUNET_HashCode * key, void *value)
479 return GNUNET_NO; 489 return GNUNET_NO;
480 } 490 }
481 data_length = msize - meta_length; 491 data_length = msize - meta_length;
492#if DEBUG_DHT
482 LOG (GNUNET_ERROR_TYPE_DEBUG, 493 LOG (GNUNET_ERROR_TYPE_DEBUG,
483 "Giving %u byte reply for %s to application\n", 494 "Giving %u byte reply for %s to application\n",
484 (unsigned int) data_length, 495 (unsigned int) data_length,
485 GNUNET_h2s (key)); 496 GNUNET_h2s (key));
497#endif
486 put_path = (const struct GNUNET_PeerIdentity *) &dht_msg[1]; 498 put_path = (const struct GNUNET_PeerIdentity *) &dht_msg[1];
487 get_path = &put_path[put_path_length]; 499 get_path = &put_path[put_path_length];
488 data = &get_path[get_path_length]; 500 data = &get_path[get_path_length];
@@ -509,8 +521,10 @@ service_message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
509 521
510 if (msg == NULL) 522 if (msg == NULL)
511 { 523 {
524#if DEBUG_DHT
512 LOG (GNUNET_ERROR_TYPE_DEBUG, 525 LOG (GNUNET_ERROR_TYPE_DEBUG,
513 "Error receiving data from DHT service, reconnecting\n"); 526 "Error receiving data from DHT service, reconnecting\n");
527#endif
514 do_disconnect (handle); 528 do_disconnect (handle);
515 return; 529 return;
516 } 530 }
@@ -527,10 +541,12 @@ service_message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
527 return; 541 return;
528 } 542 }
529 dht_msg = (const struct GNUNET_DHT_ClientResultMessage *) msg; 543 dht_msg = (const struct GNUNET_DHT_ClientResultMessage *) msg;
544#if DEBUG_DHT
530 LOG (GNUNET_ERROR_TYPE_DEBUG, 545 LOG (GNUNET_ERROR_TYPE_DEBUG,
531 "Received reply for `%s' from DHT service %p\n", 546 "Received reply for `%s' from DHT service %p\n",
532 GNUNET_h2s (&dht_msg->key), 547 GNUNET_h2s (&dht_msg->key),
533 handle); 548 handle);
549#endif
534 GNUNET_CONTAINER_multihashmap_get_multiple (handle->active_requests, 550 GNUNET_CONTAINER_multihashmap_get_multiple (handle->active_requests,
535 &dht_msg->key, &process_reply, 551 &dht_msg->key, &process_reply,
536 (void *) dht_msg); 552 (void *) dht_msg);
@@ -735,10 +751,12 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
735 GNUNET_break (0); 751 GNUNET_break (0);
736 return NULL; 752 return NULL;
737 } 753 }
754#if DEBUG_DHT
738 LOG (GNUNET_ERROR_TYPE_DEBUG, 755 LOG (GNUNET_ERROR_TYPE_DEBUG,
739 "Sending query for %s to DHT %p\n", 756 "Sending query for %s to DHT %p\n",
740 GNUNET_h2s (key), 757 GNUNET_h2s (key),
741 handle); 758 handle);
759#endif
742 pending = GNUNET_malloc (sizeof (struct PendingMessage) + msize); 760 pending = GNUNET_malloc (sizeof (struct PendingMessage) + msize);
743 get_msg = (struct GNUNET_DHT_ClientGetMessage *) &pending[1]; 761 get_msg = (struct GNUNET_DHT_ClientGetMessage *) &pending[1];
744 pending->msg = &get_msg->header; 762 pending->msg = &get_msg->header;
@@ -784,10 +802,12 @@ GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle)
784 handle = get_handle->message->handle; 802 handle = get_handle->message->handle;
785 get_msg = 803 get_msg =
786 (const struct GNUNET_DHT_ClientGetMessage *) get_handle->message->msg; 804 (const struct GNUNET_DHT_ClientGetMessage *) get_handle->message->msg;
805#if DEBUG_DHT
787 LOG (GNUNET_ERROR_TYPE_DEBUG, 806 LOG (GNUNET_ERROR_TYPE_DEBUG,
788 "Sending STOP for %s to DHT via %p\n", 807 "Sending STOP for %s to DHT via %p\n",
789 GNUNET_h2s (&get_msg->key), 808 GNUNET_h2s (&get_msg->key),
790 handle); 809 handle);
810#endif
791 /* generate STOP */ 811 /* generate STOP */
792 pending = 812 pending =
793 GNUNET_malloc (sizeof (struct PendingMessage) + 813 GNUNET_malloc (sizeof (struct PendingMessage) +
diff --git a/src/dht/gnunet-service-dht.h b/src/dht/gnunet-service-dht.h
index 2877a156b..f06b24b74 100644
--- a/src/dht/gnunet-service-dht.h
+++ b/src/dht/gnunet-service-dht.h
@@ -30,6 +30,8 @@
30#include "gnunet_statistics_service.h" 30#include "gnunet_statistics_service.h"
31#include "gnunet_transport_service.h" 31#include "gnunet_transport_service.h"
32 32
33#define DEBUG_DHT GNUNET_EXTRA_LOGGING
34
33/** 35/**
34 * Configuration we use. 36 * Configuration we use.
35 */ 37 */
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c
index 6f7c1daae..4b9eecc58 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -248,10 +248,12 @@ remove_client_records (void *cls, const GNUNET_HashCode * key, void *value)
248 248
249 if (record->client != client) 249 if (record->client != client)
250 return GNUNET_YES; 250 return GNUNET_YES;
251#if DEBUG_DHT
251 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 252 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
252 "Removing client %p's record for key %s\n", 253 "Removing client %p's record for key %s\n",
253 client, 254 client,
254 GNUNET_h2s (key)); 255 GNUNET_h2s (key));
256#endif
255 GNUNET_assert (GNUNET_YES == 257 GNUNET_assert (GNUNET_YES ==
256 GNUNET_CONTAINER_multihashmap_remove (forward_map, 258 GNUNET_CONTAINER_multihashmap_remove (forward_map,
257 key, record)); 259 key, record));
@@ -280,9 +282,11 @@ handle_client_disconnect (void *cls,
280 struct ClientList *pos; 282 struct ClientList *pos;
281 struct PendingMessage *reply; 283 struct PendingMessage *reply;
282 284
285#if DEBUG_DHT
283 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 286 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
284 "Local client %p disconnects\n", 287 "Local client %p disconnects\n",
285 client); 288 client);
289#endif
286 pos = find_active_client (client); 290 pos = find_active_client (client);
287 GNUNET_CONTAINER_DLL_remove (client_head, 291 GNUNET_CONTAINER_DLL_remove (client_head,
288 client_tail, 292 client_tail,
@@ -410,10 +414,12 @@ handle_dht_local_put (void *cls, struct GNUNET_SERVER_Client *client,
410 GNUNET_NO); 414 GNUNET_NO);
411 dht_msg = (const struct GNUNET_DHT_ClientPutMessage *) message; 415 dht_msg = (const struct GNUNET_DHT_ClientPutMessage *) message;
412 /* give to local clients */ 416 /* give to local clients */
417#if DEBUG_DHT
413 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 418 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
414 "Handling local PUT of %u-bytes for query %s\n", 419 "Handling local PUT of %u-bytes for query %s\n",
415 size - sizeof (struct GNUNET_DHT_ClientPutMessage), 420 size - sizeof (struct GNUNET_DHT_ClientPutMessage),
416 GNUNET_h2s (&dht_msg->key)); 421 GNUNET_h2s (&dht_msg->key));
422#endif
417 GDS_CLIENTS_handle_reply (GNUNET_TIME_absolute_ntoh (dht_msg->expiration), 423 GDS_CLIENTS_handle_reply (GNUNET_TIME_absolute_ntoh (dht_msg->expiration),
418 &dht_msg->key, 424 &dht_msg->key,
419 0, NULL, 425 0, NULL,
@@ -479,10 +485,12 @@ handle_dht_local_get (void *cls, struct GNUNET_SERVER_Client *client,
479 GNUNET_STATISTICS_update (GDS_stats, 485 GNUNET_STATISTICS_update (GDS_stats,
480 gettext_noop ("# GET requests received from clients"), 1, 486 gettext_noop ("# GET requests received from clients"), 1,
481 GNUNET_NO); 487 GNUNET_NO);
488#if DEBUG_DHT
482 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 489 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
483 "Received request for %s from local client %p\n", 490 "Received request for %s from local client %p\n",
484 GNUNET_h2s (&get->key), 491 GNUNET_h2s (&get->key),
485 client); 492 client);
493#endif
486 cqr = GNUNET_malloc (sizeof (struct ClientQueryRecord) + xquery_size); 494 cqr = GNUNET_malloc (sizeof (struct ClientQueryRecord) + xquery_size);
487 cqr->key = get->key; 495 cqr->key = get->key;
488 cqr->client = find_active_client (client); 496 cqr->client = find_active_client (client);
@@ -546,10 +554,12 @@ remove_by_unique_id (void *cls, const GNUNET_HashCode * key, void *value)
546 554
547 if (record->unique_id != ctx->unique_id) 555 if (record->unique_id != ctx->unique_id)
548 return GNUNET_YES; 556 return GNUNET_YES;
557#if DEBUG_DHT
549 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 558 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
550 "Removing client %p's record for key %s (by unique id)\n", 559 "Removing client %p's record for key %s (by unique id)\n",
551 ctx->client->client_handle, 560 ctx->client->client_handle,
552 GNUNET_h2s (key)); 561 GNUNET_h2s (key));
562#endif
553 return remove_client_records (ctx->client, key, record); 563 return remove_client_records (ctx->client, key, record);
554} 564}
555 565
@@ -574,10 +584,12 @@ handle_dht_local_get_stop (void *cls, struct GNUNET_SERVER_Client *client,
574 GNUNET_STATISTICS_update (GDS_stats, 584 GNUNET_STATISTICS_update (GDS_stats,
575 gettext_noop ("# GET STOP requests received from clients"), 1, 585 gettext_noop ("# GET STOP requests received from clients"), 1,
576 GNUNET_NO); 586 GNUNET_NO);
587#if DEBUG_DHT
577 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 588 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
578 "Client %p stopped request for key %s\n", 589 "Client %p stopped request for key %s\n",
579 client, 590 client,
580 GNUNET_h2s (&dht_stop_msg->key)); 591 GNUNET_h2s (&dht_stop_msg->key));
592#endif
581 ctx.client = find_active_client (client); 593 ctx.client = find_active_client (client);
582 ctx.unique_id = dht_stop_msg->unique_id; 594 ctx.unique_id = dht_stop_msg->unique_id;
583 GNUNET_CONTAINER_multihashmap_get_multiple (forward_map, 595 GNUNET_CONTAINER_multihashmap_get_multiple (forward_map,
@@ -622,9 +634,11 @@ send_reply_to_client (void *cls, size_t size, void *buf)
622 if (buf == NULL) 634 if (buf == NULL)
623 { 635 {
624 /* client disconnected */ 636 /* client disconnected */
637#if DEBUG_DHT
625 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 638 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
626 "Client %p disconnected, pending messages will be discarded\n", 639 "Client %p disconnected, pending messages will be discarded\n",
627 client->client_handle); 640 client->client_handle);
641#endif
628 return 0; 642 return 0;
629 } 643 }
630 off = 0; 644 off = 0;
@@ -635,18 +649,22 @@ send_reply_to_client (void *cls, size_t size, void *buf)
635 reply); 649 reply);
636 memcpy (&cbuf[off], reply->msg, msize); 650 memcpy (&cbuf[off], reply->msg, msize);
637 GNUNET_free (reply); 651 GNUNET_free (reply);
652#if DEBUG_DHT
638 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 653 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
639 "Transmitting %u bytes to client %p\n", 654 "Transmitting %u bytes to client %p\n",
640 msize, 655 msize,
641 client->client_handle); 656 client->client_handle);
657#endif
642 off += msize; 658 off += msize;
643 } 659 }
644 process_pending_messages (client); 660 process_pending_messages (client);
661#if DEBUG_DHT
645 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 662 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
646 "Transmitted %u/%u bytes to client %p\n", 663 "Transmitted %u/%u bytes to client %p\n",
647 (unsigned int) off, 664 (unsigned int) off,
648 (unsigned int) size, 665 (unsigned int) size,
649 client->client_handle); 666 client->client_handle);
667#endif
650 return off; 668 return off;
651} 669}
652 670
@@ -661,19 +679,23 @@ process_pending_messages (struct ClientList *client)
661{ 679{
662 if ((client->pending_head == NULL) || (client->transmit_handle != NULL)) 680 if ((client->pending_head == NULL) || (client->transmit_handle != NULL))
663 { 681 {
682#if DEBUG_DHT
664 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 683 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
665 "Not asking for transmission to %p now: %s\n", 684 "Not asking for transmission to %p now: %s\n",
666 client->client_handle, 685 client->client_handle,
667 client->pending_head == NULL 686 client->pending_head == NULL
668 ? "no more messages" 687 ? "no more messages"
669 : "request already pending"); 688 : "request already pending");
689#endif
670 return; 690 return;
671 } 691 }
692#if DEBUG_DHT
672 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 693 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
673 "Asking for transmission of %u bytes to client %p\n", 694 "Asking for transmission of %u bytes to client %p\n",
674 ntohs (client->pending_head-> 695 ntohs (client->pending_head->
675 msg->size), 696 msg->size),
676 client->client_handle); 697 client->client_handle);
698#endif
677 client->transmit_handle = 699 client->transmit_handle =
678 GNUNET_SERVER_notify_transmit_ready (client->client_handle, 700 GNUNET_SERVER_notify_transmit_ready (client->client_handle,
679 ntohs (client->pending_head-> 701 ntohs (client->pending_head->
@@ -759,9 +781,11 @@ forward_reply (void *cls, const GNUNET_HashCode * key, void *value)
759 if ( (record->type != GNUNET_BLOCK_TYPE_ANY) && 781 if ( (record->type != GNUNET_BLOCK_TYPE_ANY) &&
760 (record->type != frc->type) ) 782 (record->type != frc->type) )
761 { 783 {
784#if DEBUG_DHT
762 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 785 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
763 "Record type missmatch, not passing request for key %s to local client\n", 786 "Record type missmatch, not passing request for key %s to local client\n",
764 GNUNET_h2s (key)); 787 GNUNET_h2s (key));
788#endif
765 GNUNET_STATISTICS_update (GDS_stats, 789 GNUNET_STATISTICS_update (GDS_stats,
766 gettext_noop ("# Key match, type mismatches in REPLY to CLIENT"), 1, 790 gettext_noop ("# Key match, type mismatches in REPLY to CLIENT"), 1,
767 GNUNET_NO); 791 GNUNET_NO);
@@ -775,9 +799,11 @@ forward_reply (void *cls, const GNUNET_HashCode * key, void *value)
775 &ch, 799 &ch,
776 sizeof (GNUNET_HashCode))) 800 sizeof (GNUNET_HashCode)))
777 { 801 {
802#if DEBUG_DHT
778 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 803 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
779 "Duplicate reply, not passing request for key %s to local client\n", 804 "Duplicate reply, not passing request for key %s to local client\n",
780 GNUNET_h2s (key)); 805 GNUNET_h2s (key));
806#endif
781 GNUNET_STATISTICS_update (GDS_stats, 807 GNUNET_STATISTICS_update (GDS_stats,
782 gettext_noop ("# Duplicate REPLIES to CLIENT request dropped"), 1, 808 gettext_noop ("# Duplicate REPLIES to CLIENT request dropped"), 1,
783 GNUNET_NO); 809 GNUNET_NO);
@@ -791,10 +817,12 @@ forward_reply (void *cls, const GNUNET_HashCode * key, void *value)
791 record->xquery_size, 817 record->xquery_size,
792 frc->data, 818 frc->data,
793 frc->data_size); 819 frc->data_size);
820#if DEBUG_DHT
794 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 821 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
795 "Evaluation result is %d for key %s for local client's query\n", 822 "Evaluation result is %d for key %s for local client's query\n",
796 (int) eval, 823 (int) eval,
797 GNUNET_h2s (key)); 824 GNUNET_h2s (key));
825#endif
798 switch (eval) 826 switch (eval)
799 { 827 {
800 case GNUNET_BLOCK_EVALUATION_OK_LAST: 828 case GNUNET_BLOCK_EVALUATION_OK_LAST:
@@ -848,10 +876,12 @@ forward_reply (void *cls, const GNUNET_HashCode * key, void *value)
848 GNUNET_NO); 876 GNUNET_NO);
849 reply = (struct GNUNET_DHT_ClientResultMessage*) &pm[1]; 877 reply = (struct GNUNET_DHT_ClientResultMessage*) &pm[1];
850 reply->unique_id = record->unique_id; 878 reply->unique_id = record->unique_id;
879#if DEBUG_DHT
851 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 880 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
852 "Queueing reply to query %s for client %p\n", 881 "Queueing reply to query %s for client %p\n",
853 GNUNET_h2s (key), 882 GNUNET_h2s (key),
854 record->client->client_handle); 883 record->client->client_handle);
884#endif
855 add_pending_message (record->client, pm); 885 add_pending_message (record->client, pm);
856 if (GNUNET_YES == do_free) 886 if (GNUNET_YES == do_free)
857 remove_client_records (record->client, key, record); 887 remove_client_records (record->client, key, record);
diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c
index 8876aeea4..f3b2e5b2f 100644
--- a/src/dht/gnunet-service-dht_datacache.c
+++ b/src/dht/gnunet-service-dht_datacache.c
@@ -89,7 +89,7 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
89 if (datacache == NULL) 89 if (datacache == NULL)
90 { 90 {
91 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 91 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
92 "%s request received, but have no datacache!\n", 92 _("%s request received, but have no datacache!\n"),
93 "PUT"); 93 "PUT");
94 return; 94 return;
95 } 95 }
@@ -199,10 +199,12 @@ datacache_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
199 ctx->xquery_size, 199 ctx->xquery_size,
200 rdata, 200 rdata,
201 rdata_size); 201 rdata_size);
202#if DEBUG_DHT
202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
203 "Found reply for query %s in datacache, evaluation result is %d\n", 204 "Found reply for query %s in datacache, evaluation result is %d\n",
204 GNUNET_h2s (key), 205 GNUNET_h2s (key),
205 (int) eval); 206 (int) eval);
207#endif
206 ctx->eval = eval; 208 ctx->eval = eval;
207 switch (eval) 209 switch (eval)
208 { 210 {
@@ -243,7 +245,7 @@ datacache_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
243 gettext_noop ("# Unsupported RESULTS found in datacache"), 1, 245 gettext_noop ("# Unsupported RESULTS found in datacache"), 1,
244 GNUNET_NO); 246 GNUNET_NO);
245 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 247 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
246 "Unsupported block type (%u) in local response!\n", 248 _("Unsupported block type (%u) in local response!\n"),
247 type); 249 type);
248 break; 250 break;
249 } 251 }
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 45df22b89..637c9ecc7 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -523,10 +523,12 @@ add_known_to_bloom (void *cls, const GNUNET_HashCode * key, void *value)
523 GNUNET_HashCode mh; 523 GNUNET_HashCode mh;
524 524
525 GNUNET_BLOCK_mingle_hash (key, ctx->bf_mutator, &mh); 525 GNUNET_BLOCK_mingle_hash (key, ctx->bf_mutator, &mh);
526#if DEBUG_DHT
526 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 527 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
527 "Adding known peer (%s) to bloomfilter for FIND PEER with mutation %u\n", 528 "Adding known peer (%s) to bloomfilter for FIND PEER with mutation %u\n",
528 GNUNET_h2s (key), 529 GNUNET_h2s (key),
529 ctx->bf_mutator); 530 ctx->bf_mutator);
531#endif
530 GNUNET_CONTAINER_bloomfilter_add (ctx->bloom, &mh); 532 GNUNET_CONTAINER_bloomfilter_add (ctx->bloom, &mh);
531 return GNUNET_YES; 533 return GNUNET_YES;
532} 534}
@@ -613,10 +615,12 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
613 /* Check for connect to self message */ 615 /* Check for connect to self message */
614 if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) 616 if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity)))
615 return; 617 return;
618#if DEBUG_DHT
616 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 619 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
617 "Connected %s to %s\n", 620 "Connected %s to %s\n",
618 GNUNET_i2s (&my_identity), 621 GNUNET_i2s (&my_identity),
619 GNUNET_h2s (&peer->hashPubKey)); 622 GNUNET_h2s (&peer->hashPubKey));
623#endif
620 if (GNUNET_YES == 624 if (GNUNET_YES ==
621 GNUNET_CONTAINER_multihashmap_contains (all_known_peers, 625 GNUNET_CONTAINER_multihashmap_contains (all_known_peers,
622 &peer->hashPubKey)) 626 &peer->hashPubKey))
@@ -676,10 +680,12 @@ handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
676 /* Check for disconnect from self message */ 680 /* Check for disconnect from self message */
677 if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) 681 if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity)))
678 return; 682 return;
683#if DEBUG_DHT
679 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 684 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
680 "Disconnected %s from %s\n", 685 "Disconnected %s from %s\n",
681 GNUNET_i2s (&my_identity), 686 GNUNET_i2s (&my_identity),
682 GNUNET_h2s (&peer->hashPubKey)); 687 GNUNET_h2s (&peer->hashPubKey));
688#endif
683 to_remove = 689 to_remove =
684 GNUNET_CONTAINER_multihashmap_get (all_known_peers, &peer->hashPubKey); 690 GNUNET_CONTAINER_multihashmap_get (all_known_peers, &peer->hashPubKey);
685 if (NULL == to_remove) 691 if (NULL == to_remove)
@@ -1035,10 +1041,12 @@ select_peer (const GNUNET_HashCode *key,
1035 } 1041 }
1036 else 1042 else
1037 { 1043 {
1044#if DEBUG_DHT
1038 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1045 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1039 "Excluded peer `%s' due to BF match in greedy routing for %s\n", 1046 "Excluded peer `%s' due to BF match in greedy routing for %s\n",
1040 GNUNET_i2s (&pos->id), 1047 GNUNET_i2s (&pos->id),
1041 GNUNET_h2s (key)); 1048 GNUNET_h2s (key));
1049#endif
1042 GNUNET_STATISTICS_update (GDS_stats, 1050 GNUNET_STATISTICS_update (GDS_stats,
1043 gettext_noop ("# Peers excluded from routing due to Bloomfilter"), 1, 1051 gettext_noop ("# Peers excluded from routing due to Bloomfilter"), 1,
1044 GNUNET_NO); 1052 GNUNET_NO);
@@ -1069,10 +1077,12 @@ select_peer (const GNUNET_HashCode *key,
1069 GNUNET_STATISTICS_update (GDS_stats, 1077 GNUNET_STATISTICS_update (GDS_stats,
1070 gettext_noop ("# Peers excluded from routing due to Bloomfilter"), 1, 1078 gettext_noop ("# Peers excluded from routing due to Bloomfilter"), 1,
1071 GNUNET_NO); 1079 GNUNET_NO);
1080#if DEBUG_DHT
1072 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1081 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1073 "Excluded peer `%s' due to BF match in random routing for %s\n", 1082 "Excluded peer `%s' due to BF match in random routing for %s\n",
1074 GNUNET_i2s (&pos->id), 1083 GNUNET_i2s (&pos->id),
1075 GNUNET_h2s (key)); 1084 GNUNET_h2s (key));
1085#endif
1076 pos = pos->next; 1086 pos = pos->next;
1077 continue; /* Ignore bloomfiltered peers */ 1087 continue; /* Ignore bloomfiltered peers */
1078 } 1088 }
@@ -1155,6 +1165,7 @@ get_target_peers (const GNUNET_HashCode *key,
1155 GNUNET_CONTAINER_bloomfilter_test (bloom, &nxt->id.hashPubKey)); 1165 GNUNET_CONTAINER_bloomfilter_test (bloom, &nxt->id.hashPubKey));
1156 GNUNET_CONTAINER_bloomfilter_add (bloom, &rtargets[off]->id.hashPubKey); 1166 GNUNET_CONTAINER_bloomfilter_add (bloom, &rtargets[off]->id.hashPubKey);
1157 } 1167 }
1168#if DEBUG_DHT
1158 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1159 "Selected %u/%u peers at hop %u for %s (target was %u)\n", 1170 "Selected %u/%u peers at hop %u for %s (target was %u)\n",
1160 off, 1171 off,
@@ -1162,6 +1173,7 @@ get_target_peers (const GNUNET_HashCode *key,
1162 (unsigned int) hop_count, 1173 (unsigned int) hop_count,
1163 GNUNET_h2s (key), 1174 GNUNET_h2s (key),
1164 ret); 1175 ret);
1176#endif
1165 if (0 == off) 1177 if (0 == off)
1166 { 1178 {
1167 GNUNET_free (rtargets); 1179 GNUNET_free (rtargets);
@@ -1215,10 +1227,12 @@ GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type,
1215 struct GNUNET_PeerIdentity *pp; 1227 struct GNUNET_PeerIdentity *pp;
1216 1228
1217 GNUNET_assert (NULL != bf); 1229 GNUNET_assert (NULL != bf);
1230#if DEBUG_DHT
1218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1231 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1219 "Adding myself (%s) to PUT bloomfilter for %s\n", 1232 "Adding myself (%s) to PUT bloomfilter for %s\n",
1220 GNUNET_i2s (&my_identity), 1233 GNUNET_i2s (&my_identity),
1221 GNUNET_h2s (key)); 1234 GNUNET_h2s (key));
1235#endif
1222 GNUNET_CONTAINER_bloomfilter_add (bf, &my_identity.hashPubKey); 1236 GNUNET_CONTAINER_bloomfilter_add (bf, &my_identity.hashPubKey);
1223 GNUNET_STATISTICS_update (GDS_stats, 1237 GNUNET_STATISTICS_update (GDS_stats,
1224 gettext_noop ("# PUT requests routed"), 1, 1238 gettext_noop ("# PUT requests routed"), 1,
@@ -1228,11 +1242,13 @@ GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type,
1228 &targets); 1242 &targets);
1229 if (0 == target_count) 1243 if (0 == target_count)
1230 { 1244 {
1245#if DEBUG_DHT
1231 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1246 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1232 "Routing PUT for %s terminates after %u hops at %s\n", 1247 "Routing PUT for %s terminates after %u hops at %s\n",
1233 GNUNET_h2s (key), 1248 GNUNET_h2s (key),
1234 (unsigned int) hop_count, 1249 (unsigned int) hop_count,
1235 GNUNET_i2s (&my_identity)); 1250 GNUNET_i2s (&my_identity));
1251#endif
1236 return; 1252 return;
1237 } 1253 }
1238 msize = put_path_length * sizeof (struct GNUNET_PeerIdentity) + data_size + sizeof (struct PeerPutMessage); 1254 msize = put_path_length * sizeof (struct GNUNET_PeerIdentity) + data_size + sizeof (struct PeerPutMessage);
@@ -1253,11 +1269,13 @@ GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type,
1253 for (i=0;i<target_count;i++) 1269 for (i=0;i<target_count;i++)
1254 { 1270 {
1255 target = targets[i]; 1271 target = targets[i];
1272#if DEBUG_DHT
1256 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1273 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1257 "Routing PUT for %s after %u hops to %s\n", 1274 "Routing PUT for %s after %u hops to %s\n",
1258 GNUNET_h2s (key), 1275 GNUNET_h2s (key),
1259 (unsigned int) hop_count, 1276 (unsigned int) hop_count,
1260 GNUNET_i2s (&target->id)); 1277 GNUNET_i2s (&target->id));
1278#endif
1261 pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize); 1279 pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize);
1262 pending->importance = 0; /* FIXME */ 1280 pending->importance = 0; /* FIXME */
1263 pending->timeout = expiration_time; 1281 pending->timeout = expiration_time;
@@ -1336,20 +1354,24 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1336 target_count = get_target_peers (key, peer_bf, hop_count, 1354 target_count = get_target_peers (key, peer_bf, hop_count,
1337 desired_replication_level, 1355 desired_replication_level,
1338 &targets); 1356 &targets);
1357#if DEBUG_DHT
1339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1358 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1340 "Adding myself (%s) to GET bloomfilter for %s\n", 1359 "Adding myself (%s) to GET bloomfilter for %s\n",
1341 GNUNET_i2s (&my_identity), 1360 GNUNET_i2s (&my_identity),
1342 GNUNET_h2s (key)); 1361 GNUNET_h2s (key));
1362#endif
1343 GNUNET_CONTAINER_bloomfilter_add (peer_bf, &my_identity.hashPubKey); 1363 GNUNET_CONTAINER_bloomfilter_add (peer_bf, &my_identity.hashPubKey);
1344 if (0 == target_count) 1364 if (0 == target_count)
1345 { 1365 {
1346 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1366#if DEBUG_DHT
1347 "Routing GET for %s terminates after %u hops at %s\n", 1367 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1348 GNUNET_h2s (key), 1368 "Routing GET for %s terminates after %u hops at %s\n",
1349 (unsigned int) hop_count, 1369 GNUNET_h2s (key),
1350 GNUNET_i2s (&my_identity)); 1370 (unsigned int) hop_count,
1351 return; 1371 GNUNET_i2s (&my_identity));
1352 } 1372#endif
1373 return;
1374 }
1353 reply_bf_size = GNUNET_CONTAINER_bloomfilter_get_size (reply_bf); 1375 reply_bf_size = GNUNET_CONTAINER_bloomfilter_get_size (reply_bf);
1354 msize = xquery_size + sizeof (struct PeerGetMessage) + reply_bf_size; 1376 msize = xquery_size + sizeof (struct PeerGetMessage) + reply_bf_size;
1355 if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 1377 if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
@@ -1365,11 +1387,13 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1365 for (i=0;i<target_count;i++) 1387 for (i=0;i<target_count;i++)
1366 { 1388 {
1367 target = targets[i]; 1389 target = targets[i];
1390#if DEBUG_DHT
1368 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1391 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1369 "Routing GET for %s after %u hops to %s\n", 1392 "Routing GET for %s after %u hops to %s\n",
1370 GNUNET_h2s (key), 1393 GNUNET_h2s (key),
1371 (unsigned int) hop_count, 1394 (unsigned int) hop_count,
1372 GNUNET_i2s (&target->id)); 1395 GNUNET_i2s (&target->id));
1396#endif
1373 pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize); 1397 pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize);
1374 pending->importance = 0; /* FIXME */ 1398 pending->importance = 0; /* FIXME */
1375 pending->timeout = GNUNET_TIME_relative_to_absolute (GET_TIMEOUT); 1399 pending->timeout = GNUNET_TIME_relative_to_absolute (GET_TIMEOUT);
@@ -1573,10 +1597,12 @@ handle_dht_p2p_put (void *cls,
1573 /* cannot verify, good luck */ 1597 /* cannot verify, good luck */
1574 break; 1598 break;
1575 } 1599 }
1600#if DEBUG_DHT
1576 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1601 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1577 "PUT for %s at %s\n", 1602 "PUT for %s at %s\n",
1578 GNUNET_h2s (&put->key), 1603 GNUNET_h2s (&put->key),
1579 GNUNET_i2s (&my_identity)); 1604 GNUNET_i2s (&my_identity));
1605#endif
1580 bf = GNUNET_CONTAINER_bloomfilter_init (put->bloomfilter, 1606 bf = GNUNET_CONTAINER_bloomfilter_init (put->bloomfilter,
1581 DHT_BLOOM_SIZE, 1607 DHT_BLOOM_SIZE,
1582 GNUNET_CONSTANTS_BLOOMFILTER_K); 1608 GNUNET_CONSTANTS_BLOOMFILTER_K);
@@ -1809,11 +1835,13 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
1809 &get->key, 1835 &get->key,
1810 xquery, xquery_size, 1836 xquery, xquery_size,
1811 reply_bf, get->bf_mutator); 1837 reply_bf, get->bf_mutator);
1838#if DEBUG_DHT
1812 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1839 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1813 "GET for %s at %s after %u hops\n", 1840 "GET for %s at %s after %u hops\n",
1814 GNUNET_h2s (&get->key), 1841 GNUNET_h2s (&get->key),
1815 GNUNET_i2s (&my_identity), 1842 GNUNET_i2s (&my_identity),
1816 (unsigned int) ntohl (get->hop_count)); 1843 (unsigned int) ntohl (get->hop_count));
1844#endif
1817 /* local lookup (this may update the reply_bf) */ 1845 /* local lookup (this may update the reply_bf) */
1818 if ( (0 != (options & GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE)) || 1846 if ( (0 != (options & GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE)) ||
1819 (am_closest_peer (&get->key, 1847 (am_closest_peer (&get->key,