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 | |
parent | ef76e090bf279f25038c03eec4eac96bbfbe952e (diff) | |
download | gnunet-4dcb414e2faabc800577c25dec3b63e3ceaaa84b.tar.gz gnunet-4dcb414e2faabc800577c25dec3b63e3ceaaa84b.zip |
adding DEBUG logic for #3863
-rw-r--r-- | src/core/gnunet-service-core.h | 5 | ||||
-rw-r--r-- | src/core/gnunet-service-core_clients.c | 94 | ||||
-rw-r--r-- | src/core/gnunet-service-core_neighbours.c | 36 | ||||
-rw-r--r-- | src/core/gnunet-service-core_sessions.c | 4 | ||||
-rw-r--r-- | src/transport/transport_api.c | 61 |
5 files changed, 143 insertions, 57 deletions
diff --git a/src/core/gnunet-service-core.h b/src/core/gnunet-service-core.h index a95dc561f..15e995921 100644 --- a/src/core/gnunet-service-core.h +++ b/src/core/gnunet-service-core.h | |||
@@ -67,6 +67,11 @@ struct GSC_ClientActiveRequest | |||
67 | struct GNUNET_PeerIdentity target; | 67 | struct GNUNET_PeerIdentity target; |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * At what time did we first see this request? | ||
71 | */ | ||
72 | struct GNUNET_TIME_Absolute received_time; | ||
73 | |||
74 | /** | ||
70 | * By what time would the client want to see this message out? | 75 | * By what time would the client want to see this message out? |
71 | */ | 76 | */ |
72 | struct GNUNET_TIME_Absolute deadline; | 77 | struct GNUNET_TIME_Absolute deadline; |
diff --git a/src/core/gnunet-service-core_clients.c b/src/core/gnunet-service-core_clients.c index e90d91529..57a5d5826 100644 --- a/src/core/gnunet-service-core_clients.c +++ b/src/core/gnunet-service-core_clients.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "gnunet_transport_service.h" | 29 | #include "gnunet_transport_service.h" |
30 | #include "gnunet-service-core.h" | 30 | #include "gnunet-service-core.h" |
31 | #include "gnunet-service-core_clients.h" | 31 | #include "gnunet-service-core_clients.h" |
32 | #include "gnunet-service-core_neighbours.h" | ||
32 | #include "gnunet-service-core_sessions.h" | 33 | #include "gnunet-service-core_sessions.h" |
33 | #include "gnunet-service-core_typemap.h" | 34 | #include "gnunet-service-core_typemap.h" |
34 | #include "core.h" | 35 | #include "core.h" |
@@ -149,7 +150,8 @@ find_client (struct GNUNET_SERVER_Client *client) | |||
149 | */ | 150 | */ |
150 | static void | 151 | static void |
151 | send_to_client (struct GSC_Client *client, | 152 | send_to_client (struct GSC_Client *client, |
152 | const struct GNUNET_MessageHeader *msg, int can_drop) | 153 | const struct GNUNET_MessageHeader *msg, |
154 | int can_drop) | ||
153 | { | 155 | { |
154 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 156 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
155 | "Preparing to send %u bytes of message of type %u to client.\n", | 157 | "Preparing to send %u bytes of message of type %u to client.\n", |
@@ -219,8 +221,10 @@ type_match (uint16_t type, struct GSC_Client *c) | |||
219 | */ | 221 | */ |
220 | static void | 222 | static void |
221 | send_to_all_clients (const struct GNUNET_PeerIdentity *partner, | 223 | send_to_all_clients (const struct GNUNET_PeerIdentity *partner, |
222 | const struct GNUNET_MessageHeader *msg, int can_drop, | 224 | const struct GNUNET_MessageHeader *msg, |
223 | uint32_t options, uint16_t type) | 225 | int can_drop, |
226 | uint32_t options, | ||
227 | uint16_t type) | ||
224 | { | 228 | { |
225 | struct GSC_Client *c; | 229 | struct GSC_Client *c; |
226 | int tm; | 230 | int tm; |
@@ -399,6 +403,7 @@ handle_client_send_request (void *cls, | |||
399 | GSC_SESSIONS_dequeue_request (car); | 403 | GSC_SESSIONS_dequeue_request (car); |
400 | } | 404 | } |
401 | car->target = req->peer; | 405 | car->target = req->peer; |
406 | car->received_time = GNUNET_TIME_absolute_get (); | ||
402 | car->deadline = GNUNET_TIME_absolute_ntoh (req->deadline); | 407 | car->deadline = GNUNET_TIME_absolute_ntoh (req->deadline); |
403 | car->priority = (enum GNUNET_CORE_Priority) ntohl (req->priority); | 408 | car->priority = (enum GNUNET_CORE_Priority) ntohl (req->priority); |
404 | car->msize = ntohs (req->size); | 409 | car->msize = ntohs (req->size); |
@@ -441,7 +446,7 @@ struct TokenizerContext | |||
441 | 446 | ||
442 | 447 | ||
443 | /** | 448 | /** |
444 | * Handle CORE_SEND request. | 449 | * Handle #GNUNET_MESSAGE_TYPE_CORE_CORE_SEND request. |
445 | * | 450 | * |
446 | * @param cls unused | 451 | * @param cls unused |
447 | * @param client the client issuing the request | 452 | * @param client the client issuing the request |
@@ -456,6 +461,7 @@ handle_client_send (void *cls, | |||
456 | struct GSC_Client *c; | 461 | struct GSC_Client *c; |
457 | struct TokenizerContext tc; | 462 | struct TokenizerContext tc; |
458 | uint16_t msize; | 463 | uint16_t msize; |
464 | struct GNUNET_TIME_Relative delay; | ||
459 | 465 | ||
460 | msize = ntohs (message->size); | 466 | msize = ntohs (message->size); |
461 | if (msize < | 467 | if (msize < |
@@ -476,8 +482,9 @@ handle_client_send (void *cls, | |||
476 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 482 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
477 | return; | 483 | return; |
478 | } | 484 | } |
479 | tc.car = | 485 | tc.car |
480 | GNUNET_CONTAINER_multipeermap_get (c->requests, &sm->peer); | 486 | = GNUNET_CONTAINER_multipeermap_get (c->requests, |
487 | &sm->peer); | ||
481 | if (NULL == tc.car) | 488 | if (NULL == tc.car) |
482 | { | 489 | { |
483 | /* Must have been that we first approved the request, then got disconnected | 490 | /* Must have been that we first approved the request, then got disconnected |
@@ -489,28 +496,49 @@ handle_client_send (void *cls, | |||
489 | gettext_noop | 496 | gettext_noop |
490 | ("# messages discarded (session disconnected)"), | 497 | ("# messages discarded (session disconnected)"), |
491 | 1, GNUNET_NO); | 498 | 1, GNUNET_NO); |
492 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 499 | GNUNET_SERVER_receive_done (client, |
500 | GNUNET_OK); | ||
493 | return; | 501 | return; |
494 | } | 502 | } |
503 | delay = GNUNET_TIME_absolute_get_duration (tc.car->received_time); | ||
504 | tc.cork = ntohl (sm->cork); | ||
505 | tc.priority = (enum GNUNET_CORE_Priority) ntohl (sm->priority); | ||
506 | if (delay.rel_value_us > GNUNET_TIME_UNIT_SECONDS.rel_value_us) | ||
507 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
508 | "Client waited %s for transmission of %u bytes to `%s'%s, CORE queue is %u entries\n", | ||
509 | GNUNET_STRINGS_relative_time_to_string (delay, | ||
510 | GNUNET_YES), | ||
511 | msize, | ||
512 | GNUNET_i2s (&sm->peer), | ||
513 | tc.cork ? "" : " (corked)", | ||
514 | GSC_NEIGHBOURS_get_queue_size (&sm->peer)); | ||
515 | else | ||
516 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
517 | "Client waited %s for transmission of %u bytes to `%s'%s, CORE queue is %u entries\n", | ||
518 | GNUNET_STRINGS_relative_time_to_string (delay, | ||
519 | GNUNET_YES), | ||
520 | msize, | ||
521 | GNUNET_i2s (&sm->peer), | ||
522 | tc.cork ? "" : " (corked)", | ||
523 | GSC_NEIGHBOURS_get_queue_size (&sm->peer)); | ||
524 | |||
495 | GNUNET_assert (GNUNET_YES == | 525 | GNUNET_assert (GNUNET_YES == |
496 | GNUNET_CONTAINER_multipeermap_remove (c->requests, | 526 | GNUNET_CONTAINER_multipeermap_remove (c->requests, |
497 | &sm->peer, | 527 | &sm->peer, |
498 | tc.car)); | 528 | tc.car)); |
499 | tc.cork = ntohl (sm->cork); | ||
500 | tc.priority = (enum GNUNET_CORE_Priority) ntohl (sm->priority); | ||
501 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
502 | "Client asked for transmission of %u bytes to `%s' %s\n", | ||
503 | msize, | ||
504 | GNUNET_i2s (&sm->peer), tc.cork ? "now" : ""); | ||
505 | GNUNET_SERVER_mst_receive (client_mst, &tc, | 529 | GNUNET_SERVER_mst_receive (client_mst, &tc, |
506 | (const char *) &sm[1], msize, | 530 | (const char *) &sm[1], |
507 | GNUNET_YES, GNUNET_NO); | 531 | msize, |
532 | GNUNET_YES, | ||
533 | GNUNET_NO); | ||
508 | if (0 != | 534 | if (0 != |
509 | memcmp (&tc.car->target, &GSC_my_identity, | 535 | memcmp (&tc.car->target, |
536 | &GSC_my_identity, | ||
510 | sizeof (struct GNUNET_PeerIdentity))) | 537 | sizeof (struct GNUNET_PeerIdentity))) |
511 | GSC_SESSIONS_dequeue_request (tc.car); | 538 | GSC_SESSIONS_dequeue_request (tc.car); |
512 | GNUNET_free (tc.car); | 539 | GNUNET_free (tc.car); |
513 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 540 | GNUNET_SERVER_receive_done (client, |
541 | GNUNET_OK); | ||
514 | } | 542 | } |
515 | 543 | ||
516 | 544 | ||
@@ -525,7 +553,8 @@ handle_client_send (void *cls, | |||
525 | * @param message the actual message | 553 | * @param message the actual message |
526 | */ | 554 | */ |
527 | static int | 555 | static int |
528 | client_tokenizer_callback (void *cls, void *client, | 556 | client_tokenizer_callback (void *cls, |
557 | void *client, | ||
529 | const struct GNUNET_MessageHeader *message) | 558 | const struct GNUNET_MessageHeader *message) |
530 | { | 559 | { |
531 | struct TokenizerContext *tc = client; | 560 | struct TokenizerContext *tc = client; |
@@ -535,9 +564,13 @@ client_tokenizer_callback (void *cls, void *client, | |||
535 | GNUNET_snprintf (buf, sizeof (buf), | 564 | GNUNET_snprintf (buf, sizeof (buf), |
536 | gettext_noop ("# bytes of messages of type %u received"), | 565 | gettext_noop ("# bytes of messages of type %u received"), |
537 | (unsigned int) ntohs (message->type)); | 566 | (unsigned int) ntohs (message->type)); |
538 | GNUNET_STATISTICS_update (GSC_stats, buf, ntohs (message->size), GNUNET_NO); | 567 | GNUNET_STATISTICS_update (GSC_stats, |
568 | buf, | ||
569 | ntohs (message->size), | ||
570 | GNUNET_NO); | ||
539 | if (0 == | 571 | if (0 == |
540 | memcmp (&car->target, &GSC_my_identity, | 572 | memcmp (&car->target, |
573 | &GSC_my_identity, | ||
541 | sizeof (struct GNUNET_PeerIdentity))) | 574 | sizeof (struct GNUNET_PeerIdentity))) |
542 | { | 575 | { |
543 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 576 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -618,7 +651,8 @@ handle_client_disconnect (void *cls, | |||
618 | if (NULL == client) | 651 | if (NULL == client) |
619 | return; | 652 | return; |
620 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 653 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
621 | "Client %p has disconnected from core service.\n", client); | 654 | "Client %p has disconnected from core service.\n", |
655 | client); | ||
622 | c = find_client (client); | 656 | c = find_client (client); |
623 | if (c == NULL) | 657 | if (c == NULL) |
624 | return; /* client never sent INIT */ | 658 | return; /* client never sent INIT */ |
@@ -654,6 +688,8 @@ GSC_CLIENTS_solicit_request (struct GSC_ClientActiveRequest *car) | |||
654 | { | 688 | { |
655 | struct GSC_Client *c; | 689 | struct GSC_Client *c; |
656 | struct SendMessageReady smr; | 690 | struct SendMessageReady smr; |
691 | struct GNUNET_TIME_Relative delay; | ||
692 | struct GNUNET_TIME_Relative left; | ||
657 | 693 | ||
658 | c = car->client_handle; | 694 | c = car->client_handle; |
659 | if (GNUNET_YES != | 695 | if (GNUNET_YES != |
@@ -662,12 +698,26 @@ GSC_CLIENTS_solicit_request (struct GSC_ClientActiveRequest *car) | |||
662 | { | 698 | { |
663 | /* connection has gone down since, drop request */ | 699 | /* connection has gone down since, drop request */ |
664 | GNUNET_assert (0 != | 700 | GNUNET_assert (0 != |
665 | memcmp (&car->target, &GSC_my_identity, | 701 | memcmp (&car->target, |
702 | &GSC_my_identity, | ||
666 | sizeof (struct GNUNET_PeerIdentity))); | 703 | sizeof (struct GNUNET_PeerIdentity))); |
667 | GSC_SESSIONS_dequeue_request (car); | 704 | GSC_SESSIONS_dequeue_request (car); |
668 | GSC_CLIENTS_reject_request (car); | 705 | GSC_CLIENTS_reject_request (car); |
669 | return; | 706 | return; |
670 | } | 707 | } |
708 | delay = GNUNET_TIME_absolute_get_duration (car->received_time); | ||
709 | left = GNUNET_TIME_absolute_get_remaining (car->deadline); | ||
710 | if ( (delay.rel_value_us > GNUNET_TIME_UNIT_SECONDS.rel_value_us) || | ||
711 | (0 == left.rel_value_us) ) | ||
712 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
713 | "Client waited %s for permission to transmit to `%s'%s (priority %u)\n", | ||
714 | GNUNET_STRINGS_relative_time_to_string (delay, | ||
715 | GNUNET_YES), | ||
716 | GNUNET_i2s (&car->target), | ||
717 | (0 == left.rel_value_us) | ||
718 | ? " (past deadline)" | ||
719 | : "", | ||
720 | car->priority); | ||
671 | smr.header.size = htons (sizeof (struct SendMessageReady)); | 721 | smr.header.size = htons (sizeof (struct SendMessageReady)); |
672 | smr.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_SEND_READY); | 722 | smr.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_SEND_READY); |
673 | smr.size = htons (car->msize); | 723 | smr.size = htons (car->msize); |
diff --git a/src/core/gnunet-service-core_neighbours.c b/src/core/gnunet-service-core_neighbours.c index 5e5ed4db3..f89206dfe 100644 --- a/src/core/gnunet-service-core_neighbours.c +++ b/src/core/gnunet-service-core_neighbours.c | |||
@@ -57,9 +57,14 @@ struct NeighbourMessageEntry | |||
57 | struct GNUNET_TIME_Absolute deadline; | 57 | struct GNUNET_TIME_Absolute deadline; |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * How long is the message? (number of bytes following the "struct | 60 | * What time did we submit the request? |
61 | * MessageEntry", but not including the size of "struct | 61 | */ |
62 | * MessageEntry" itself!) | 62 | struct GNUNET_TIME_Absolute submission_time; |
63 | |||
64 | /** | ||
65 | * How long is the message? (number of bytes following the `struct | ||
66 | * MessageEntry`, but not including the size of `struct | ||
67 | * MessageEntry` itself!) | ||
63 | */ | 68 | */ |
64 | size_t size; | 69 | size_t size; |
65 | 70 | ||
@@ -157,7 +162,7 @@ free_neighbour (struct Neighbour *n) | |||
157 | struct NeighbourMessageEntry *m; | 162 | struct NeighbourMessageEntry *m; |
158 | 163 | ||
159 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 164 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
160 | "Destroying neighbour entry for peer `%4s'\n", | 165 | "Destroying neighbour entry for peer `%s'\n", |
161 | GNUNET_i2s (&n->peer)); | 166 | GNUNET_i2s (&n->peer)); |
162 | while (NULL != (m = n->message_head)) | 167 | while (NULL != (m = n->message_head)) |
163 | { | 168 | { |
@@ -227,6 +232,7 @@ transmit_ready (void *cls, | |||
227 | struct NeighbourMessageEntry *m; | 232 | struct NeighbourMessageEntry *m; |
228 | size_t ret; | 233 | size_t ret; |
229 | char *cbuf; | 234 | char *cbuf; |
235 | struct GNUNET_TIME_Relative delay; | ||
230 | 236 | ||
231 | n->th = NULL; | 237 | n->th = NULL; |
232 | m = n->message_head; | 238 | m = n->message_head; |
@@ -250,18 +256,31 @@ transmit_ready (void *cls, | |||
250 | process_queue (n); | 256 | process_queue (n); |
251 | return 0; | 257 | return 0; |
252 | } | 258 | } |
259 | delay = GNUNET_TIME_absolute_get_duration (m->submission_time); | ||
253 | cbuf = buf; | 260 | cbuf = buf; |
254 | GNUNET_assert (size >= m->size); | 261 | GNUNET_assert (size >= m->size); |
255 | memcpy (cbuf, | 262 | memcpy (cbuf, |
256 | &m[1], | 263 | &m[1], |
257 | m->size); | 264 | m->size); |
258 | ret = m->size; | 265 | ret = m->size; |
259 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 266 | if (delay.rel_value_us > GNUNET_TIME_UNIT_SECONDS.rel_value_us) |
260 | "Copied message of type %u and size %u into transport buffer for `%4s'\n", | 267 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
268 | "Copied message of type %u and size %u into transport buffer for `%s' with delay of %s\n", | ||
261 | (unsigned int) | 269 | (unsigned int) |
262 | ntohs (((struct GNUNET_MessageHeader *) &m[1])->type), | 270 | ntohs (((struct GNUNET_MessageHeader *) &m[1])->type), |
263 | (unsigned int) ret, | 271 | (unsigned int) ret, |
264 | GNUNET_i2s (&n->peer)); | 272 | GNUNET_i2s (&n->peer), |
273 | GNUNET_STRINGS_relative_time_to_string (delay, | ||
274 | GNUNET_YES)); | ||
275 | else | ||
276 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
277 | "Copied message of type %u and size %u into transport buffer for `%s' with delay of %s\n", | ||
278 | (unsigned int) | ||
279 | ntohs (((struct GNUNET_MessageHeader *) &m[1])->type), | ||
280 | (unsigned int) ret, | ||
281 | GNUNET_i2s (&n->peer), | ||
282 | GNUNET_STRINGS_relative_time_to_string (delay, | ||
283 | GNUNET_YES)); | ||
265 | GNUNET_free (m); | 284 | GNUNET_free (m); |
266 | n->has_excess_bandwidth = GNUNET_NO; | 285 | n->has_excess_bandwidth = GNUNET_NO; |
267 | process_queue (n); | 286 | process_queue (n); |
@@ -295,11 +314,12 @@ process_queue (struct Neighbour *n) | |||
295 | return; | 314 | return; |
296 | } | 315 | } |
297 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 316 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
298 | "Asking transport for transmission of %u bytes to `%4s' in next %s\n", | 317 | "Asking transport for transmission of %u bytes to `%s' in next %s\n", |
299 | (unsigned int) m->size, | 318 | (unsigned int) m->size, |
300 | GNUNET_i2s (&n->peer), | 319 | GNUNET_i2s (&n->peer), |
301 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (m->deadline), | 320 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (m->deadline), |
302 | GNUNET_NO)); | 321 | GNUNET_NO)); |
322 | m->submission_time = GNUNET_TIME_absolute_get (); | ||
303 | n->th | 323 | n->th |
304 | = GNUNET_TRANSPORT_notify_transmit_ready (transport, | 324 | = GNUNET_TRANSPORT_notify_transmit_ready (transport, |
305 | &n->peer, | 325 | &n->peer, |
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c index 8706c873e..bbabf8866 100644 --- a/src/core/gnunet-service-core_sessions.c +++ b/src/core/gnunet-service-core_sessions.c | |||
@@ -125,12 +125,12 @@ struct Session | |||
125 | /** | 125 | /** |
126 | * Task to transmit corked messages with a delay. | 126 | * Task to transmit corked messages with a delay. |
127 | */ | 127 | */ |
128 | struct GNUNET_SCHEDULER_Task * cork_task; | 128 | struct GNUNET_SCHEDULER_Task *cork_task; |
129 | 129 | ||
130 | /** | 130 | /** |
131 | * Task to transmit our type map. | 131 | * Task to transmit our type map. |
132 | */ | 132 | */ |
133 | struct GNUNET_SCHEDULER_Task * typemap_task; | 133 | struct GNUNET_SCHEDULER_Task *typemap_task; |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * Retransmission delay we currently use for the typemap | 136 | * Retransmission delay we currently use for the typemap |
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); |