diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-10-05 16:35:44 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-10-05 16:35:44 +0000 |
commit | 4dcb414e2faabc800577c25dec3b63e3ceaaa84b (patch) | |
tree | c9e7b5139a3f04bbcd65ddfc10d1bab05e6e0741 /src/transport/transport_api.c | |
parent | ef76e090bf279f25038c03eec4eac96bbfbe952e (diff) | |
download | gnunet-4dcb414e2faabc800577c25dec3b63e3ceaaa84b.tar.gz gnunet-4dcb414e2faabc800577c25dec3b63e3ceaaa84b.zip |
adding DEBUG logic for #3863
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r-- | src/transport/transport_api.c | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 8ebf82b8a..312762ba4 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -84,7 +84,7 @@ struct GNUNET_TRANSPORT_TransmitHandle | |||
84 | * Task to trigger request timeout if the request is stalled due to | 84 | * Task to trigger request timeout if the request is stalled due to |
85 | * congestion. | 85 | * congestion. |
86 | */ | 86 | */ |
87 | struct GNUNET_SCHEDULER_Task * timeout_task; | 87 | struct GNUNET_SCHEDULER_Task *timeout_task; |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * How many bytes is our notify callback waiting for? | 90 | * How many bytes is our notify callback waiting for? |
@@ -171,7 +171,7 @@ struct GNUNET_TRANSPORT_GetHelloHandle | |||
171 | /** | 171 | /** |
172 | * Task for calling the HelloUpdateCallback when we already have a HELLO | 172 | * Task for calling the HelloUpdateCallback when we already have a HELLO |
173 | */ | 173 | */ |
174 | struct GNUNET_SCHEDULER_Task * notify_task; | 174 | struct GNUNET_SCHEDULER_Task *notify_task; |
175 | 175 | ||
176 | /** | 176 | /** |
177 | * Closure for @e rec. | 177 | * Closure for @e rec. |
@@ -422,7 +422,7 @@ struct GNUNET_TRANSPORT_Handle | |||
422 | * Heap sorting peers with pending messages by the timestamps that | 422 | * Heap sorting peers with pending messages by the timestamps that |
423 | * specify when we could next send a message to the respective peer. | 423 | * specify when we could next send a message to the respective peer. |
424 | * Excludes control messages (which can always go out immediately). | 424 | * Excludes control messages (which can always go out immediately). |
425 | * Maps time stamps to 'struct Neighbour' entries. | 425 | * Maps time stamps to `struct Neighbour` entries. |
426 | */ | 426 | */ |
427 | struct GNUNET_CONTAINER_Heap *ready_heap; | 427 | struct GNUNET_CONTAINER_Heap *ready_heap; |
428 | 428 | ||
@@ -439,10 +439,10 @@ struct GNUNET_TRANSPORT_Handle | |||
439 | /** | 439 | /** |
440 | * ID of the task trying to trigger transmission for a peer while | 440 | * ID of the task trying to trigger transmission for a peer while |
441 | * maintaining bandwidth quotas. In use if there are no control | 441 | * maintaining bandwidth quotas. In use if there are no control |
442 | * messages and the smallest entry in the 'ready_heap' has a time | 442 | * messages and the smallest entry in the @e ready_heap has a time |
443 | * stamp in the future. | 443 | * stamp in the future. |
444 | */ | 444 | */ |
445 | struct GNUNET_SCHEDULER_Task * quota_task; | 445 | struct GNUNET_SCHEDULER_Task *quota_task; |
446 | 446 | ||
447 | /** | 447 | /** |
448 | * Delay until we try to reconnect. | 448 | * Delay until we try to reconnect. |
@@ -515,7 +515,7 @@ outbound_bw_tracker_update (void *cls) | |||
515 | delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, | 515 | delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, |
516 | n->th->notify_size + n->traffic_overhead); | 516 | n->th->notify_size + n->traffic_overhead); |
517 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 517 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
518 | "New outbound delay %llu us\n", | 518 | "New outbound delay %s us\n", |
519 | GNUNET_STRINGS_relative_time_to_string (delay, | 519 | GNUNET_STRINGS_relative_time_to_string (delay, |
520 | GNUNET_NO)); | 520 | GNUNET_NO)); |
521 | GNUNET_CONTAINER_heap_update_cost (n->h->ready_heap, | 521 | GNUNET_CONTAINER_heap_update_cost (n->h->ready_heap, |
@@ -554,7 +554,7 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h, | |||
554 | struct Neighbour *n; | 554 | struct Neighbour *n; |
555 | 555 | ||
556 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 556 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
557 | "Creating entry for neighbour `%4s'.\n", | 557 | "Creating entry for neighbour `%s'.\n", |
558 | GNUNET_i2s (pid)); | 558 | GNUNET_i2s (pid)); |
559 | n = GNUNET_new (struct Neighbour); | 559 | n = GNUNET_new (struct Neighbour); |
560 | n->id = *pid; | 560 | n->id = *pid; |
@@ -664,7 +664,7 @@ demultiplexer (void *cls, | |||
664 | break; | 664 | break; |
665 | } | 665 | } |
666 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 666 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
667 | "Receiving (my own) HELLO message (%u bytes), I am `%4s'.\n", | 667 | "Receiving (my own) HELLO message (%u bytes), I am `%s'.\n", |
668 | (unsigned int) size, | 668 | (unsigned int) size, |
669 | GNUNET_i2s (&me)); | 669 | GNUNET_i2s (&me)); |
670 | GNUNET_free_non_null (h->my_hello); | 670 | GNUNET_free_non_null (h->my_hello); |
@@ -698,7 +698,7 @@ demultiplexer (void *cls, | |||
698 | break; | 698 | break; |
699 | } | 699 | } |
700 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 700 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
701 | "Receiving CONNECT message for `%4s'.\n", | 701 | "Receiving CONNECT message for `%s'.\n", |
702 | GNUNET_i2s (&cim->id)); | 702 | GNUNET_i2s (&cim->id)); |
703 | n = neighbour_find (h, &cim->id); | 703 | n = neighbour_find (h, &cim->id); |
704 | if (NULL != n) | 704 | if (NULL != n) |
@@ -709,7 +709,7 @@ demultiplexer (void *cls, | |||
709 | n = neighbour_add (h, | 709 | n = neighbour_add (h, |
710 | &cim->id); | 710 | &cim->id); |
711 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 711 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
712 | "Receiving CONNECT message for `%4s' with quota %u\n", | 712 | "Receiving CONNECT message for `%s' with quota %u\n", |
713 | GNUNET_i2s (&cim->id), | 713 | GNUNET_i2s (&cim->id), |
714 | ntohl (cim->quota_out.value__)); | 714 | ntohl (cim->quota_out.value__)); |
715 | GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker, | 715 | GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker, |
@@ -727,7 +727,7 @@ demultiplexer (void *cls, | |||
727 | dim = (const struct DisconnectInfoMessage *) msg; | 727 | dim = (const struct DisconnectInfoMessage *) msg; |
728 | GNUNET_break (ntohl (dim->reserved) == 0); | 728 | GNUNET_break (ntohl (dim->reserved) == 0); |
729 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 729 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
730 | "Receiving DISCONNECT message for `%4s'.\n", | 730 | "Receiving DISCONNECT message for `%s'.\n", |
731 | GNUNET_i2s (&dim->peer)); | 731 | GNUNET_i2s (&dim->peer)); |
732 | n = neighbour_find (h, &dim->peer); | 732 | n = neighbour_find (h, &dim->peer); |
733 | if (NULL == n) | 733 | if (NULL == n) |
@@ -792,7 +792,7 @@ demultiplexer (void *cls, | |||
792 | break; | 792 | break; |
793 | } | 793 | } |
794 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 794 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
795 | "Received message of type %u from `%4s'.\n", | 795 | "Received message of type %u from `%s'.\n", |
796 | ntohs (imm->type), GNUNET_i2s (&im->peer)); | 796 | ntohs (imm->type), GNUNET_i2s (&im->peer)); |
797 | n = neighbour_find (h, &im->peer); | 797 | n = neighbour_find (h, &im->peer); |
798 | if (NULL == n) | 798 | if (NULL == n) |
@@ -816,7 +816,7 @@ demultiplexer (void *cls, | |||
816 | if (NULL == n) | 816 | if (NULL == n) |
817 | break; | 817 | break; |
818 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 818 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
819 | "Receiving SET_QUOTA message for `%4s' with quota %u\n", | 819 | "Receiving SET_QUOTA message for `%s' with quota %u\n", |
820 | GNUNET_i2s (&qm->peer), | 820 | GNUNET_i2s (&qm->peer), |
821 | ntohl (qm->quota.value__)); | 821 | ntohl (qm->quota.value__)); |
822 | GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker, | 822 | GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker, |
@@ -1262,7 +1262,7 @@ send_try_connect (void *cls, | |||
1262 | if (NULL == buf) | 1262 | if (NULL == buf) |
1263 | { | 1263 | { |
1264 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1264 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1265 | "Discarding `%s' request to `%4s' due to error in transport service connection.\n", | 1265 | "Discarding `%s' request to `%s' due to error in transport service connection.\n", |
1266 | "REQUEST_CONNECT", | 1266 | "REQUEST_CONNECT", |
1267 | GNUNET_i2s (&tch->pid)); | 1267 | GNUNET_i2s (&tch->pid)); |
1268 | if (NULL != tch->cb) | 1268 | if (NULL != tch->cb) |
@@ -1272,7 +1272,7 @@ send_try_connect (void *cls, | |||
1272 | return 0; | 1272 | return 0; |
1273 | } | 1273 | } |
1274 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1274 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1275 | "Transmitting `%s' request with respect to `%4s'.\n", | 1275 | "Transmitting `%s' request with respect to `%s'.\n", |
1276 | "REQUEST_CONNECT", | 1276 | "REQUEST_CONNECT", |
1277 | GNUNET_i2s (&tch->pid)); | 1277 | GNUNET_i2s (&tch->pid)); |
1278 | GNUNET_assert (size >= sizeof (struct TransportRequestConnectMessage)); | 1278 | GNUNET_assert (size >= sizeof (struct TransportRequestConnectMessage)); |
@@ -1367,7 +1367,7 @@ send_try_disconnect (void *cls, | |||
1367 | if (NULL == buf) | 1367 | if (NULL == buf) |
1368 | { | 1368 | { |
1369 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1369 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1370 | "Discarding `%s' request to `%4s' due to error in transport service connection.\n", | 1370 | "Discarding `%s' request to `%s' due to error in transport service connection.\n", |
1371 | "REQUEST_DISCONNECT", | 1371 | "REQUEST_DISCONNECT", |
1372 | GNUNET_i2s (&tdh->pid)); | 1372 | GNUNET_i2s (&tdh->pid)); |
1373 | if (NULL != tdh->cb) | 1373 | if (NULL != tdh->cb) |
@@ -1377,7 +1377,7 @@ send_try_disconnect (void *cls, | |||
1377 | return 0; | 1377 | return 0; |
1378 | } | 1378 | } |
1379 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1379 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1380 | "Transmitting `%s' request with respect to `%4s'.\n", | 1380 | "Transmitting `%s' request with respect to `%s'.\n", |
1381 | "REQUEST_DISCONNECT", | 1381 | "REQUEST_DISCONNECT", |
1382 | GNUNET_i2s (&tdh->pid)); | 1382 | GNUNET_i2s (&tdh->pid)); |
1383 | GNUNET_assert (size >= sizeof (struct TransportRequestDisconnectMessage)); | 1383 | GNUNET_assert (size >= sizeof (struct TransportRequestDisconnectMessage)); |
@@ -1620,7 +1620,7 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, | |||
1620 | msg = GNUNET_malloc (size); | 1620 | msg = GNUNET_malloc (size); |
1621 | memcpy (msg, hello, size); | 1621 | memcpy (msg, hello, size); |
1622 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1622 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1623 | "Offering `%s' message of `%4s' to transport for validation.\n", "HELLO", | 1623 | "Offering HELLO message of `%s' to transport for validation.\n", |
1624 | GNUNET_i2s (&peer)); | 1624 | GNUNET_i2s (&peer)); |
1625 | 1625 | ||
1626 | ohh = GNUNET_new (struct GNUNET_TRANSPORT_OfferHelloHandle); | 1626 | ohh = GNUNET_new (struct GNUNET_TRANSPORT_OfferHelloHandle); |
@@ -1638,7 +1638,7 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, | |||
1638 | /** | 1638 | /** |
1639 | * Cancel the request to transport to offer the HELLO message | 1639 | * Cancel the request to transport to offer the HELLO message |
1640 | * | 1640 | * |
1641 | * @param ohh the GNUNET_TRANSPORT_OfferHelloHandle to cancel | 1641 | * @param ohh the handle for the operation to cancel |
1642 | */ | 1642 | */ |
1643 | void | 1643 | void |
1644 | GNUNET_TRANSPORT_offer_hello_cancel (struct GNUNET_TRANSPORT_OfferHelloHandle *ohh) | 1644 | GNUNET_TRANSPORT_offer_hello_cancel (struct GNUNET_TRANSPORT_OfferHelloHandle *ohh) |
@@ -1716,7 +1716,9 @@ GNUNET_TRANSPORT_get_hello (struct GNUNET_TRANSPORT_Handle *handle, | |||
1716 | hwl->rec = rec; | 1716 | hwl->rec = rec; |
1717 | hwl->rec_cls = rec_cls; | 1717 | hwl->rec_cls = rec_cls; |
1718 | hwl->handle = handle; | 1718 | hwl->handle = handle; |
1719 | GNUNET_CONTAINER_DLL_insert (handle->hwl_head, handle->hwl_tail, hwl); | 1719 | GNUNET_CONTAINER_DLL_insert (handle->hwl_head, |
1720 | handle->hwl_tail, | ||
1721 | hwl); | ||
1720 | if (NULL != handle->my_hello) | 1722 | if (NULL != handle->my_hello) |
1721 | hwl->notify_task = GNUNET_SCHEDULER_add_now (&call_hello_update_cb_async, | 1723 | hwl->notify_task = GNUNET_SCHEDULER_add_now (&call_hello_update_cb_async, |
1722 | hwl); | 1724 | hwl); |
@@ -1928,11 +1930,20 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle, | |||
1928 | n->traffic_overhead = 0; | 1930 | n->traffic_overhead = 0; |
1929 | if (delay.rel_value_us > timeout.rel_value_us) | 1931 | if (delay.rel_value_us > timeout.rel_value_us) |
1930 | delay.rel_value_us = 0; /* notify immediately (with failure) */ | 1932 | delay.rel_value_us = 0; /* notify immediately (with failure) */ |
1931 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1933 | if (delay.rel_value_us > GNUNET_TIME_UNIT_SECONDS.rel_value_us) |
1932 | "Bandwidth tracker allows next transmission to peer %s in %s\n", | 1934 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1933 | GNUNET_i2s (target), | 1935 | "At bandwidth %u byte/s next transmission to %s in %s\n", |
1934 | GNUNET_STRINGS_relative_time_to_string (delay, | 1936 | (unsigned int) n->out_tracker.available_bytes_per_s__, |
1935 | GNUNET_YES)); | 1937 | GNUNET_i2s (target), |
1938 | GNUNET_STRINGS_relative_time_to_string (delay, | ||
1939 | GNUNET_YES)); | ||
1940 | else | ||
1941 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1942 | "At bandwidth %u byte/s next transmission to %s in %s\n", | ||
1943 | (unsigned int) n->out_tracker.available_bytes_per_s__, | ||
1944 | GNUNET_i2s (target), | ||
1945 | GNUNET_STRINGS_relative_time_to_string (delay, | ||
1946 | GNUNET_YES)); | ||
1936 | n->hn = GNUNET_CONTAINER_heap_insert (handle->ready_heap, | 1947 | n->hn = GNUNET_CONTAINER_heap_insert (handle->ready_heap, |
1937 | n, | 1948 | n, |
1938 | delay.rel_value_us); | 1949 | delay.rel_value_us); |