diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-02-18 18:57:46 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-02-18 18:57:46 +0000 |
commit | 6d0a62078edfa5c0001acb93d517c674c5124f4e (patch) | |
tree | 07fe5fa62330e2d62156e629b011ba878c9b2a13 /src/dht | |
parent | b4896204368760831aa06842fd9a21e28d78d7b4 (diff) | |
download | gnunet-6d0a62078edfa5c0001acb93d517c674c5124f4e.tar.gz gnunet-6d0a62078edfa5c0001acb93d517c674c5124f4e.zip |
-die ifdefs, die
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/dht_api.c | 28 | ||||
-rw-r--r-- | src/dht/test_dht_api.c | 4 |
2 files changed, 3 insertions, 29 deletions
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c index d53728fa9..3cb13b4f9 100644 --- a/src/dht/dht_api.c +++ b/src/dht/dht_api.c | |||
@@ -34,8 +34,6 @@ | |||
34 | #include "gnunet_dht_service.h" | 34 | #include "gnunet_dht_service.h" |
35 | #include "dht.h" | 35 | #include "dht.h" |
36 | 36 | ||
37 | #define DEBUG_DHT_API GNUNET_EXTRA_LOGGING | ||
38 | |||
39 | #define LOG(kind,...) GNUNET_log_from (kind, "dht-api",__VA_ARGS__) | 37 | #define LOG(kind,...) GNUNET_log_from (kind, "dht-api",__VA_ARGS__) |
40 | 38 | ||
41 | /** | 39 | /** |
@@ -303,11 +301,9 @@ add_request_to_pending (void *cls, const GNUNET_HashCode * key, void *value) | |||
303 | 301 | ||
304 | if (GNUNET_NO == rh->message->in_pending_queue) | 302 | if (GNUNET_NO == rh->message->in_pending_queue) |
305 | { | 303 | { |
306 | #if DEBUG_DHT | ||
307 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 304 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
308 | "Retransmitting request related to %s to DHT %p\n", GNUNET_h2s (key), | 305 | "Retransmitting request related to %s to DHT %p\n", GNUNET_h2s (key), |
309 | handle); | 306 | handle); |
310 | #endif | ||
311 | GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail, | 307 | GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail, |
312 | rh->message); | 308 | rh->message); |
313 | rh->message->in_pending_queue = GNUNET_YES; | 309 | rh->message->in_pending_queue = GNUNET_YES; |
@@ -335,9 +331,7 @@ try_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
335 | { | 331 | { |
336 | struct GNUNET_DHT_Handle *handle = cls; | 332 | struct GNUNET_DHT_Handle *handle = cls; |
337 | 333 | ||
338 | #if DEBUG_DHT | ||
339 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Reconnecting with DHT %p\n", handle); | 334 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Reconnecting with DHT %p\n", handle); |
340 | #endif | ||
341 | handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; | 335 | handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; |
342 | if (handle->retry_time.rel_value < GNUNET_CONSTANTS_SERVICE_RETRY.rel_value) | 336 | if (handle->retry_time.rel_value < GNUNET_CONSTANTS_SERVICE_RETRY.rel_value) |
343 | handle->retry_time = GNUNET_CONSTANTS_SERVICE_RETRY; | 337 | handle->retry_time = GNUNET_CONSTANTS_SERVICE_RETRY; |
@@ -348,9 +342,7 @@ try_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
348 | handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; | 342 | handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; |
349 | if (GNUNET_YES != try_connect (handle)) | 343 | if (GNUNET_YES != try_connect (handle)) |
350 | { | 344 | { |
351 | #if DEBUG_DHT | ||
352 | LOG (GNUNET_ERROR_TYPE_DEBUG, "dht reconnect failed(!)\n"); | 345 | LOG (GNUNET_ERROR_TYPE_DEBUG, "dht reconnect failed(!)\n"); |
353 | #endif | ||
354 | return; | 346 | return; |
355 | } | 347 | } |
356 | GNUNET_CONTAINER_multihashmap_iterate (handle->active_requests, | 348 | GNUNET_CONTAINER_multihashmap_iterate (handle->active_requests, |
@@ -435,11 +427,9 @@ transmit_pending (void *cls, size_t size, void *buf) | |||
435 | 427 | ||
436 | handle->th = NULL; | 428 | handle->th = NULL; |
437 | if (buf == NULL) | 429 | if (buf == NULL) |
438 | { | 430 | { |
439 | #if DEBUG_DHT | ||
440 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 431 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
441 | "Transmission to DHT service failed! Reconnecting!\n"); | 432 | "Transmission to DHT service failed! Reconnecting!\n"); |
442 | #endif | ||
443 | do_disconnect (handle); | 433 | do_disconnect (handle); |
444 | return 0; | 434 | return 0; |
445 | } | 435 | } |
@@ -470,15 +460,11 @@ transmit_pending (void *cls, size_t size, void *buf) | |||
470 | if (GNUNET_YES == head->free_on_send) | 460 | if (GNUNET_YES == head->free_on_send) |
471 | GNUNET_free (head); | 461 | GNUNET_free (head); |
472 | process_pending_messages (handle); | 462 | process_pending_messages (handle); |
473 | #if DEBUG_DHT | ||
474 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 463 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
475 | "Forwarded request of %u bytes to DHT service\n", (unsigned int) tsize); | 464 | "Forwarded request of %u bytes to DHT service\n", (unsigned int) tsize); |
476 | #endif | ||
477 | if (GNUNET_NO == handle->in_receive) | 465 | if (GNUNET_NO == handle->in_receive) |
478 | { | 466 | { |
479 | #if DEBUG_DHT | ||
480 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting to process replies from DHT\n"); | 467 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting to process replies from DHT\n"); |
481 | #endif | ||
482 | handle->in_receive = GNUNET_YES; | 468 | handle->in_receive = GNUNET_YES; |
483 | GNUNET_CLIENT_receive (handle->client, &service_message_handler, handle, | 469 | GNUNET_CLIENT_receive (handle->client, &service_message_handler, handle, |
484 | GNUNET_TIME_UNIT_FOREVER_REL); | 470 | GNUNET_TIME_UNIT_FOREVER_REL); |
@@ -514,11 +500,9 @@ process_reply (void *cls, const GNUNET_HashCode * key, void *value) | |||
514 | if (dht_msg->unique_id != get_handle->unique_id) | 500 | if (dht_msg->unique_id != get_handle->unique_id) |
515 | { | 501 | { |
516 | /* UID mismatch */ | 502 | /* UID mismatch */ |
517 | #if DEBUG_DHT | ||
518 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 503 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
519 | "Ignoring reply for %s: UID mismatch: %llu/%llu\n", GNUNET_h2s (key), | 504 | "Ignoring reply for %s: UID mismatch: %llu/%llu\n", GNUNET_h2s (key), |
520 | dht_msg->unique_id, get_handle->unique_id); | 505 | dht_msg->unique_id, get_handle->unique_id); |
521 | #endif | ||
522 | return GNUNET_YES; | 506 | return GNUNET_YES; |
523 | } | 507 | } |
524 | msize = ntohs (dht_msg->header.size); | 508 | msize = ntohs (dht_msg->header.size); |
@@ -537,10 +521,8 @@ process_reply (void *cls, const GNUNET_HashCode * key, void *value) | |||
537 | return GNUNET_NO; | 521 | return GNUNET_NO; |
538 | } | 522 | } |
539 | data_length = msize - meta_length; | 523 | data_length = msize - meta_length; |
540 | #if DEBUG_DHT | ||
541 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Giving %u byte reply for %s to application\n", | 524 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Giving %u byte reply for %s to application\n", |
542 | (unsigned int) data_length, GNUNET_h2s (key)); | 525 | (unsigned int) data_length, GNUNET_h2s (key)); |
543 | #endif | ||
544 | put_path = (const struct GNUNET_PeerIdentity *) &dht_msg[1]; | 526 | put_path = (const struct GNUNET_PeerIdentity *) &dht_msg[1]; |
545 | get_path = &put_path[put_path_length]; | 527 | get_path = &put_path[put_path_length]; |
546 | data = &get_path[get_path_length]; | 528 | data = &get_path[get_path_length]; |
@@ -623,10 +605,8 @@ service_message_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
623 | 605 | ||
624 | if (msg == NULL) | 606 | if (msg == NULL) |
625 | { | 607 | { |
626 | #if DEBUG_DHT | ||
627 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 608 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
628 | "Error receiving data from DHT service, reconnecting\n"); | 609 | "Error receiving data from DHT service, reconnecting\n"); |
629 | #endif | ||
630 | do_disconnect (handle); | 610 | do_disconnect (handle); |
631 | return; | 611 | return; |
632 | } | 612 | } |
@@ -649,10 +629,8 @@ service_message_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
649 | return; | 629 | return; |
650 | } | 630 | } |
651 | dht_msg = (const struct GNUNET_DHT_ClientResultMessage *) msg; | 631 | dht_msg = (const struct GNUNET_DHT_ClientResultMessage *) msg; |
652 | #if DEBUG_DHT | ||
653 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received reply for `%s' from DHT service %p\n", | 632 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received reply for `%s' from DHT service %p\n", |
654 | GNUNET_h2s (&dht_msg->key), handle); | 633 | GNUNET_h2s (&dht_msg->key), handle); |
655 | #endif | ||
656 | GNUNET_CONTAINER_multihashmap_get_multiple (handle->active_requests, | 634 | GNUNET_CONTAINER_multihashmap_get_multiple (handle->active_requests, |
657 | &dht_msg->key, &process_reply, | 635 | &dht_msg->key, &process_reply, |
658 | (void *) dht_msg); | 636 | (void *) dht_msg); |
@@ -856,10 +834,8 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, | |||
856 | GNUNET_break (0); | 834 | GNUNET_break (0); |
857 | return NULL; | 835 | return NULL; |
858 | } | 836 | } |
859 | #if DEBUG_DHT | ||
860 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending query for %s to DHT %p\n", | 837 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending query for %s to DHT %p\n", |
861 | GNUNET_h2s (key), handle); | 838 | GNUNET_h2s (key), handle); |
862 | #endif | ||
863 | pending = GNUNET_malloc (sizeof (struct PendingMessage) + msize); | 839 | pending = GNUNET_malloc (sizeof (struct PendingMessage) + msize); |
864 | get_msg = (struct GNUNET_DHT_ClientGetMessage *) &pending[1]; | 840 | get_msg = (struct GNUNET_DHT_ClientGetMessage *) &pending[1]; |
865 | pending->msg = &get_msg->header; | 841 | pending->msg = &get_msg->header; |
@@ -905,10 +881,8 @@ GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle) | |||
905 | handle = get_handle->message->handle; | 881 | handle = get_handle->message->handle; |
906 | get_msg = | 882 | get_msg = |
907 | (const struct GNUNET_DHT_ClientGetMessage *) get_handle->message->msg; | 883 | (const struct GNUNET_DHT_ClientGetMessage *) get_handle->message->msg; |
908 | #if DEBUG_DHT | ||
909 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending STOP for %s to DHT via %p\n", | 884 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending STOP for %s to DHT via %p\n", |
910 | GNUNET_h2s (&get_msg->key), handle); | 885 | GNUNET_h2s (&get_msg->key), handle); |
911 | #endif | ||
912 | /* generate STOP */ | 886 | /* generate STOP */ |
913 | pending = | 887 | pending = |
914 | GNUNET_malloc (sizeof (struct PendingMessage) + | 888 | GNUNET_malloc (sizeof (struct PendingMessage) + |
diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c index 4ec2f2ae9..b31cd1a72 100644 --- a/src/dht/test_dht_api.c +++ b/src/dht/test_dht_api.c | |||
@@ -34,9 +34,9 @@ | |||
34 | #include "gnunet_dht_service.h" | 34 | #include "gnunet_dht_service.h" |
35 | #include "gnunet_hello_lib.h" | 35 | #include "gnunet_hello_lib.h" |
36 | 36 | ||
37 | #define VERBOSE GNUNET_EXTRA_LOGGING | 37 | #define VERBOSE GNUNET_NO |
38 | 38 | ||
39 | #define VERBOSE_ARM GNUNET_EXTRA_LOGGING | 39 | #define VERBOSE_ARM GNUNET_NO |
40 | 40 | ||
41 | #define START_ARM GNUNET_YES | 41 | #define START_ARM GNUNET_YES |
42 | 42 | ||