aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport_api.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-09-05 12:31:19 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-09-05 12:31:19 +0000
commit57aa3363dc8203686c8c73148dc9df2315edf8b0 (patch)
tree750b5d81f1c73e263d727e1a060378ff3b81db8c /src/transport/transport_api.c
parent9bc1d178f943c055a87eae6f501bddff29556f76 (diff)
downloadgnunet-57aa3363dc8203686c8c73148dc9df2315edf8b0.tar.gz
gnunet-57aa3363dc8203686c8c73148dc9df2315edf8b0.zip
separate transport api debug messages from transport debugging
re-enabling ats in validation
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r--src/transport/transport_api.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index 94e21a7c0..bf37b4ac6 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -46,7 +46,6 @@
46 */ 46 */
47#define STARTING_NEIGHBOURS_SIZE 16 47#define STARTING_NEIGHBOURS_SIZE 16
48 48
49
50/** 49/**
51 * Handle for a message that should be transmitted to the service. 50 * Handle for a message that should be transmitted to the service.
52 * Used for both control messages and normal messages. 51 * Used for both control messages and normal messages.
@@ -340,7 +339,7 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h,
340{ 339{
341 struct Neighbour *n; 340 struct Neighbour *n;
342 341
343#if DEBUG_TRANSPORT 342#if DEBUG_TRANSPORT_API
344 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating entry for neighbour `%4s'.\n", 343 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating entry for neighbour `%4s'.\n",
345 GNUNET_i2s (pid)); 344 GNUNET_i2s (pid));
346#endif 345#endif
@@ -412,7 +411,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
412 GNUNET_assert (h->client != NULL); 411 GNUNET_assert (h->client != NULL);
413 if (msg == NULL) 412 if (msg == NULL)
414 { 413 {
415#if DEBUG_TRANSPORT 414#if DEBUG_TRANSPORT_API
416 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 415 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
417 "Error receiving from transport service, disconnecting temporarily.\n"); 416 "Error receiving from transport service, disconnecting temporarily.\n");
418#endif 417#endif
@@ -431,7 +430,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
431 GNUNET_break (0); 430 GNUNET_break (0);
432 break; 431 break;
433 } 432 }
434#if DEBUG_TRANSPORT 433#if DEBUG_TRANSPORT_API
435 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 434 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
436 "Receiving (my own) `%s' message, I am `%4s'.\n", "HELLO", 435 "Receiving (my own) `%s' message, I am `%4s'.\n", "HELLO",
437 GNUNET_i2s (&me)); 436 GNUNET_i2s (&me));
@@ -469,7 +468,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
469 GNUNET_break (0); 468 GNUNET_break (0);
470 break; 469 break;
471 } 470 }
472#if DEBUG_TRANSPORT 471#if DEBUG_TRANSPORT_API
473 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message for `%4s'.\n", 472 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message for `%4s'.\n",
474 "CONNECT", GNUNET_i2s (&cim->id)); 473 "CONNECT", GNUNET_i2s (&cim->id));
475#endif 474#endif
@@ -491,7 +490,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
491 } 490 }
492 dim = (const struct DisconnectInfoMessage *) msg; 491 dim = (const struct DisconnectInfoMessage *) msg;
493 GNUNET_break (ntohl (dim->reserved) == 0); 492 GNUNET_break (ntohl (dim->reserved) == 0);
494#if DEBUG_TRANSPORT_DISCONNECT 493#if DEBUG_TRANSPORT_API_DISCONNECT
495 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message for `%4s'.\n", 494 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message for `%4s'.\n",
496 "DISCONNECT", GNUNET_i2s (&dim->peer)); 495 "DISCONNECT", GNUNET_i2s (&dim->peer));
497#endif 496#endif
@@ -510,7 +509,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
510 break; 509 break;
511 } 510 }
512 okm = (const struct SendOkMessage *) msg; 511 okm = (const struct SendOkMessage *) msg;
513#if DEBUG_TRANSPORT 512#if DEBUG_TRANSPORT_API
514 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 513 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
515 "Receiving `%s' message, transmission %s.\n", "SEND_OK", 514 "Receiving `%s' message, transmission %s.\n", "SEND_OK",
516 ntohl (okm->success) == GNUNET_OK ? "succeeded" : "failed"); 515 ntohl (okm->success) == GNUNET_OK ? "succeeded" : "failed");
@@ -532,7 +531,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
532 } 531 }
533 break; 532 break;
534 case GNUNET_MESSAGE_TYPE_TRANSPORT_RECV: 533 case GNUNET_MESSAGE_TYPE_TRANSPORT_RECV:
535#if DEBUG_TRANSPORT 534#if DEBUG_TRANSPORT_API
536 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message.\n", "RECV"); 535 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message.\n", "RECV");
537#endif 536#endif
538 if (size < 537 if (size <
@@ -552,7 +551,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
552 GNUNET_break (0); 551 GNUNET_break (0);
553 break; 552 break;
554 } 553 }
555#if DEBUG_TRANSPORT 554#if DEBUG_TRANSPORT_API
556 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 555 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
557 "Received message of type %u from `%4s'.\n", ntohs (imm->type), 556 "Received message of type %u from `%4s'.\n", ntohs (imm->type),
558 GNUNET_i2s (&im->peer)); 557 GNUNET_i2s (&im->peer));
@@ -636,7 +635,7 @@ transport_notify_ready (void *cls, size_t size, void *buf)
636 { 635 {
637 GNUNET_CONTAINER_DLL_remove (h->control_head, h->control_tail, th); 636 GNUNET_CONTAINER_DLL_remove (h->control_head, h->control_tail, th);
638 nret = th->notify (th->notify_cls, size, &cbuf[ret]); 637 nret = th->notify (th->notify_cls, size, &cbuf[ret]);
639#if DEBUG_TRANSPORT 638#if DEBUG_TRANSPORT_API
640 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 639 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
641 "Added %u bytes of control message at %u\n", nret, ret); 640 "Added %u bytes of control message at %u\n", nret, ret);
642#endif 641#endif
@@ -697,7 +696,7 @@ transport_notify_ready (void *cls, size_t size, void *buf)
697 } 696 }
698 /* if there are more pending messages, try to schedule those */ 697 /* if there are more pending messages, try to schedule those */
699 schedule_transmission (h); 698 schedule_transmission (h);
700#if DEBUG_TRANSPORT 699#if DEBUG_TRANSPORT_API
701 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 700 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
702 "Transmitting %u bytes to transport service\n", ret); 701 "Transmitting %u bytes to transport service\n", ret);
703#endif 702#endif
@@ -733,7 +732,7 @@ schedule_transmission_task (void *cls,
733 n->th = NULL; 732 n->th = NULL;
734 GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap)); 733 GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap));
735 n->hn = NULL; 734 n->hn = NULL;
736#if DEBUG_TRANSPORT 735#if DEBUG_TRANSPORT_API
737 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 736 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
738 "Signalling timeout for transmission to peer %s due to congestion\n", 737 "Signalling timeout for transmission to peer %s due to congestion\n",
739 GNUNET_i2s (&n->id)); 738 GNUNET_i2s (&n->id));
@@ -754,7 +753,7 @@ schedule_transmission_task (void *cls,
754 return; /* no pending messages */ 753 return; /* no pending messages */
755 size = n->th->notify_size + sizeof (struct OutboundMessage); 754 size = n->th->notify_size + sizeof (struct OutboundMessage);
756 } 755 }
757#if DEBUG_TRANSPORT 756#if DEBUG_TRANSPORT_API
758 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Calling notify_transmit_ready\n"); 757 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Calling notify_transmit_ready\n");
759#endif 758#endif
760 h->cth = 759 h->cth =
@@ -792,9 +791,11 @@ schedule_transmission (struct GNUNET_TRANSPORT_Handle *h)
792 n->th->notify_size); 791 n->th->notify_size);
793 else 792 else
794 return; /* no work to be done */ 793 return; /* no work to be done */
794#if DEBUG_TRANSPORT_API
795 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 795 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
796 "Scheduling next transmission to service in %llu ms\n", 796 "Scheduling next transmission to service in %llu ms\n",
797 (unsigned long long) delay.rel_value); 797 (unsigned long long) delay.rel_value);
798#endif
798 h->quota_task = 799 h->quota_task =
799 GNUNET_SCHEDULER_add_delayed (delay, &schedule_transmission_task, h); 800 GNUNET_SCHEDULER_add_delayed (delay, &schedule_transmission_task, h);
800} 801}
@@ -816,7 +817,7 @@ schedule_control_transmit (struct GNUNET_TRANSPORT_Handle *h, size_t size,
816{ 817{
817 struct GNUNET_TRANSPORT_TransmitHandle *th; 818 struct GNUNET_TRANSPORT_TransmitHandle *th;
818 819
819#if DEBUG_TRANSPORT 820#if DEBUG_TRANSPORT_API
820 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 821 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
821 "Control transmit of %u bytes requested\n", size); 822 "Control transmit of %u bytes requested\n", size);
822#endif 823#endif
@@ -846,13 +847,13 @@ send_start (void *cls, size_t size, void *buf)
846 if (buf == NULL) 847 if (buf == NULL)
847 { 848 {
848 /* Can only be shutdown, just give up */ 849 /* Can only be shutdown, just give up */
849#if DEBUG_TRANSPORT 850#if DEBUG_TRANSPORT_API
850 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 851 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
851 "Shutdown while trying to transmit `%s' request.\n", "START"); 852 "Shutdown while trying to transmit `%s' request.\n", "START");
852#endif 853#endif
853 return 0; 854 return 0;
854 } 855 }
855#if DEBUG_TRANSPORT 856#if DEBUG_TRANSPORT_API
856 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' request.\n", "START"); 857 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' request.\n", "START");
857#endif 858#endif
858 GNUNET_assert (size >= sizeof (struct StartMessage)); 859 GNUNET_assert (size >= sizeof (struct StartMessage));
@@ -884,7 +885,7 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
884 /* shutdown, just give up */ 885 /* shutdown, just give up */
885 return; 886 return;
886 } 887 }
887#if DEBUG_TRANSPORT 888#if DEBUG_TRANSPORT_API
888 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service.\n"); 889 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service.\n");
889#endif 890#endif
890 GNUNET_assert (h->client == NULL); 891 GNUNET_assert (h->client == NULL);
@@ -931,7 +932,7 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h)
931 th->notify (th->notify_cls, 0, NULL); 932 th->notify (th->notify_cls, 0, NULL);
932 GNUNET_free (th); 933 GNUNET_free (th);
933 } 934 }
934#if DEBUG_TRANSPORT 935#if DEBUG_TRANSPORT_API
935 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 936 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
936 "Scheduling task to reconnect to transport service in %llu ms.\n", 937 "Scheduling task to reconnect to transport service in %llu ms.\n",
937 h->reconnect_delay.rel_value); 938 h->reconnect_delay.rel_value);
@@ -988,7 +989,7 @@ send_set_quota (void *cls, size_t size, void *buf)
988 GNUNET_free (sqc); 989 GNUNET_free (sqc);
989 return 0; 990 return 0;
990 } 991 }
991#if DEBUG_TRANSPORT 992#if DEBUG_TRANSPORT_API
992 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 993 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
993 "Transmitting `%s' request with respect to `%4s'.\n", "SET_QUOTA", 994 "Transmitting `%s' request with respect to `%4s'.\n", "SET_QUOTA",
994 GNUNET_i2s (&sqc->target)); 995 GNUNET_i2s (&sqc->target));
@@ -1031,7 +1032,7 @@ GNUNET_TRANSPORT_set_quota (struct GNUNET_TRANSPORT_Handle *handle,
1031 return; 1032 return;
1032 } 1033 }
1033 GNUNET_assert (NULL != handle->client); 1034 GNUNET_assert (NULL != handle->client);
1034#if DEBUG_TRANSPORT 1035#if DEBUG_TRANSPORT_API
1035 if (ntohl (quota_out.value__) != n->out_tracker.available_bytes_per_s__) 1036 if (ntohl (quota_out.value__) != n->out_tracker.available_bytes_per_s__)
1036 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1037 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1037 "Quota changed from %u to %u for peer `%s'\n", 1038 "Quota changed from %u to %u for peer `%s'\n",
@@ -1070,7 +1071,7 @@ send_try_connect (void *cls, size_t size, void *buf)
1070 GNUNET_free (pid); 1071 GNUNET_free (pid);
1071 return 0; 1072 return 0;
1072 } 1073 }
1073#if DEBUG_TRANSPORT 1074#if DEBUG_TRANSPORT_API
1074 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1075 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1075 "Transmitting `%s' request with respect to `%4s'.\n", 1076 "Transmitting `%s' request with respect to `%4s'.\n",
1076 "REQUEST_CONNECT", GNUNET_i2s (pid)); 1077 "REQUEST_CONNECT", GNUNET_i2s (pid));
@@ -1132,7 +1133,7 @@ send_hello (void *cls, size_t size, void *buf)
1132 GNUNET_free (msg); 1133 GNUNET_free (msg);
1133 return 0; 1134 return 0;
1134 } 1135 }
1135#if DEBUG_TRANSPORT 1136#if DEBUG_TRANSPORT_API
1136 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' request.\n", "HELLO"); 1137 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' request.\n", "HELLO");
1137#endif 1138#endif
1138 ssize = ntohs (msg->size); 1139 ssize = ntohs (msg->size);
@@ -1176,7 +1177,7 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle,
1176 } 1177 }
1177 msg = GNUNET_malloc (size); 1178 msg = GNUNET_malloc (size);
1178 memcpy (msg, hello, size); 1179 memcpy (msg, hello, size);
1179#if DEBUG_TRANSPORT 1180#if DEBUG_TRANSPORT_API
1180 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1181 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1181 "Offering `%s' message of `%4s' to transport for validation.\n", 1182 "Offering `%s' message of `%4s' to transport for validation.\n",
1182 "HELLO", GNUNET_i2s (&peer)); 1183 "HELLO", GNUNET_i2s (&peer));
@@ -1279,7 +1280,7 @@ GNUNET_TRANSPORT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
1279void 1280void
1280GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) 1281GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle)
1281{ 1282{
1282#if DEBUG_TRANSPORT 1283#if DEBUG_TRANSPORT_API
1283 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transport disconnect called!\n"); 1284 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transport disconnect called!\n");
1284#endif 1285#endif
1285 /* this disconnects all neighbours... */ 1286 /* this disconnects all neighbours... */
@@ -1366,7 +1367,7 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle,
1366 delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size); 1367 delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size);
1367 if (delay.rel_value > timeout.rel_value) 1368 if (delay.rel_value > timeout.rel_value)
1368 delay.rel_value = 0; /* notify immediately (with failure) */ 1369 delay.rel_value = 0; /* notify immediately (with failure) */
1369#if DEBUG_TRANSPORT 1370#if DEBUG_TRANSPORT_API
1370 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1371 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1371 "Bandwidth tracker allows next transmission to peer %s in %llu ms\n", 1372 "Bandwidth tracker allows next transmission to peer %s in %llu ms\n",
1372 GNUNET_i2s (target), (unsigned long long) delay.rel_value); 1373 GNUNET_i2s (target), (unsigned long long) delay.rel_value);