diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-04-27 18:13:43 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-04-27 18:13:43 +0200 |
commit | 7f50a089e5308bc7691704683dea805258f6c0b2 (patch) | |
tree | 855319d41912d83d6051599cbb50426065f08cfd /src/transport/gnunet-service-tng.c | |
parent | 03d1fbcb4375693650964befdb078140b7ba142f (diff) | |
download | gnunet-7f50a089e5308bc7691704683dea805258f6c0b2.tar.gz gnunet-7f50a089e5308bc7691704683dea805258f6c0b2.zip |
rudimentary logging
Diffstat (limited to 'src/transport/gnunet-service-tng.c')
-rw-r--r-- | src/transport/gnunet-service-tng.c | 69 |
1 files changed, 64 insertions, 5 deletions
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c index 40e820e2f..b15a62cc4 100644 --- a/src/transport/gnunet-service-tng.c +++ b/src/transport/gnunet-service-tng.c | |||
@@ -3284,6 +3284,9 @@ notify_client_connect_info (void *cls, | |||
3284 | struct TransportClient *tc = cls; | 3284 | struct TransportClient *tc = cls; |
3285 | struct Neighbour *neighbour = value; | 3285 | struct Neighbour *neighbour = value; |
3286 | 3286 | ||
3287 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3288 | "Telling new CORE client about existing connection to %s\n", | ||
3289 | GNUNET_i2s (pid)); | ||
3287 | core_send_connect_info (tc, pid, neighbour->quota_out); | 3290 | core_send_connect_info (tc, pid, neighbour->quota_out); |
3288 | return GNUNET_OK; | 3291 | return GNUNET_OK; |
3289 | } | 3292 | } |
@@ -3319,6 +3322,9 @@ handle_client_start (void *cls, const struct StartMessage *start) | |||
3319 | return; | 3322 | return; |
3320 | } | 3323 | } |
3321 | tc->type = CT_CORE; | 3324 | tc->type = CT_CORE; |
3325 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3326 | "New CORE client with PID %s registered\n", | ||
3327 | GNUNET_i2s (&start->self)); | ||
3322 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, | 3328 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, |
3323 | ¬ify_client_connect_info, | 3329 | ¬ify_client_connect_info, |
3324 | tc); | 3330 | tc); |
@@ -3468,6 +3474,12 @@ client_send_response (struct PendingMessage *pm, | |||
3468 | som->bytes_msg = htons (pm->bytes_msg); | 3474 | som->bytes_msg = htons (pm->bytes_msg); |
3469 | som->bytes_physical = htonl (bytes_physical); | 3475 | som->bytes_physical = htonl (bytes_physical); |
3470 | som->peer = target->pid; | 3476 | som->peer = target->pid; |
3477 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3478 | "Confirming %s transmission of %u/%u bytes to %s\n", | ||
3479 | (GNUNET_OK == success) ? "successful" : "failed", | ||
3480 | (unsigned int) pm->bytes_msg, | ||
3481 | (unsigned int) bytes_physical, | ||
3482 | GNUNET_i2s (&pm->target->pid)); | ||
3471 | GNUNET_MQ_send (tc->mq, env); | 3483 | GNUNET_MQ_send (tc->mq, env); |
3472 | } | 3484 | } |
3473 | free_pending_message (pm); | 3485 | free_pending_message (pm); |
@@ -3554,6 +3566,27 @@ create_dv_box (uint16_t total_hops, | |||
3554 | memcpy (dhops, hops, num_hops * sizeof (struct GNUNET_PeerIdentity)); | 3566 | memcpy (dhops, hops, num_hops * sizeof (struct GNUNET_PeerIdentity)); |
3555 | dhops[num_hops] = *target; | 3567 | dhops[num_hops] = *target; |
3556 | memcpy (&dhops[num_hops + 1], payload, payload_size); | 3568 | memcpy (&dhops[num_hops + 1], payload, payload_size); |
3569 | |||
3570 | if (GNUNET_EXTRA_LOGGING > 0) | ||
3571 | { | ||
3572 | char *path; | ||
3573 | |||
3574 | path = GNUNET_strdup (GNUNET_i2s (&dvb->origin)); | ||
3575 | for (unsigned int i = 0; i <= num_hops; i++) | ||
3576 | { | ||
3577 | char *tmp; | ||
3578 | |||
3579 | GNUNET_asprintf (&tmp, "%s-%s", path, GNUNET_i2s (&dhops[i])); | ||
3580 | GNUNET_free (path); | ||
3581 | path = tmp; | ||
3582 | } | ||
3583 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3584 | "Creating DVBox for %u bytes of payload via %s\n", | ||
3585 | (unsigned int) payload_size, | ||
3586 | path); | ||
3587 | GNUNET_free (path); | ||
3588 | } | ||
3589 | |||
3557 | return dvb; | 3590 | return dvb; |
3558 | } | 3591 | } |
3559 | 3592 | ||
@@ -3688,6 +3721,11 @@ handle_client_send (void *cls, const struct OutboundMessage *obm) | |||
3688 | GNUNET_NO); | 3721 | GNUNET_NO); |
3689 | return; | 3722 | return; |
3690 | } | 3723 | } |
3724 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3725 | "Sending %u bytes to %s using %s\n", | ||
3726 | bytes_msg, | ||
3727 | GNUNET_i2s (&obm->peer), | ||
3728 | (NULL == target) ? "distance vector path" : "direct queue"); | ||
3691 | if (NULL == target) | 3729 | if (NULL == target) |
3692 | { | 3730 | { |
3693 | unsigned int res; | 3731 | unsigned int res; |
@@ -3756,8 +3794,14 @@ handle_client_send (void *cls, const struct OutboundMessage *obm) | |||
3756 | { | 3794 | { |
3757 | /* try transmission on any queue that is idle */ | 3795 | /* try transmission on any queue that is idle */ |
3758 | if (NULL == queue->transmit_task) | 3796 | if (NULL == queue->transmit_task) |
3797 | { | ||
3798 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3799 | "Queue %llu to %s is idle, triggering transmission\n", | ||
3800 | (unsigned long long) queue->qid, | ||
3801 | GNUNET_i2s (&queue->neighbour->pid)); | ||
3759 | queue->transmit_task = | 3802 | queue->transmit_task = |
3760 | GNUNET_SCHEDULER_add_now (&transmit_on_queue, queue); | 3803 | GNUNET_SCHEDULER_add_now (&transmit_on_queue, queue); |
3804 | } | ||
3761 | } | 3805 | } |
3762 | } | 3806 | } |
3763 | 3807 | ||
@@ -3806,11 +3850,18 @@ handle_communicator_available ( | |||
3806 | 3850 | ||
3807 | size = ntohs (cam->header.size) - sizeof (*cam); | 3851 | size = ntohs (cam->header.size) - sizeof (*cam); |
3808 | if (0 == size) | 3852 | if (0 == size) |
3853 | { | ||
3854 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3855 | "Receive-only communicator connected\n"); | ||
3809 | return; /* receive-only communicator */ | 3856 | return; /* receive-only communicator */ |
3857 | } | ||
3810 | tc->details.communicator.address_prefix = | 3858 | tc->details.communicator.address_prefix = |
3811 | GNUNET_strdup ((const char *) &cam[1]); | 3859 | GNUNET_strdup ((const char *) &cam[1]); |
3812 | tc->details.communicator.cc = | 3860 | tc->details.communicator.cc = |
3813 | (enum GNUNET_TRANSPORT_CommunicatorCharacteristics) ntohl (cam->cc); | 3861 | (enum GNUNET_TRANSPORT_CommunicatorCharacteristics) ntohl (cam->cc); |
3862 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3863 | "Communicator with prefix `%s' connected\n", | ||
3864 | tc->details.communicator.address_prefix); | ||
3814 | GNUNET_SERVICE_client_continue (tc->client); | 3865 | GNUNET_SERVICE_client_continue (tc->client); |
3815 | } | 3866 | } |
3816 | 3867 | ||
@@ -3890,8 +3941,8 @@ expire_ephemerals (void *cls) | |||
3890 | 3941 | ||
3891 | 3942 | ||
3892 | /** | 3943 | /** |
3893 | * Lookup ephemeral key in our #ephemeral_map. If no valid one exists, generate | 3944 | * Lookup ephemeral key in our #ephemeral_map. If no valid one exists, |
3894 | * one, cache it and return it. | 3945 | * generate one, cache it and return it. |
3895 | * | 3946 | * |
3896 | * @param pid peer to look up ephemeral for | 3947 | * @param pid peer to look up ephemeral for |
3897 | * @param private_key[out] set to the private key | 3948 | * @param private_key[out] set to the private key |
@@ -3975,6 +4026,11 @@ queue_send_msg (struct Queue *queue, | |||
3975 | struct GNUNET_TRANSPORT_SendMessageTo *smt; | 4026 | struct GNUNET_TRANSPORT_SendMessageTo *smt; |
3976 | struct GNUNET_MQ_Envelope *env; | 4027 | struct GNUNET_MQ_Envelope *env; |
3977 | 4028 | ||
4029 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
4030 | "Queueing %u bytes of payload for transmission on queue %llu to %s\n", | ||
4031 | (unsigned int) payload_size, | ||
4032 | (unsigned long long) queue->qid, | ||
4033 | GNUNET_i2s (&queue->neighbour->pid)); | ||
3978 | env = GNUNET_MQ_msg_extra (smt, | 4034 | env = GNUNET_MQ_msg_extra (smt, |
3979 | payload_size, | 4035 | payload_size, |
3980 | GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG); | 4036 | GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG); |
@@ -4004,6 +4060,8 @@ queue_send_msg (struct Queue *queue, | |||
4004 | } | 4060 | } |
4005 | 4061 | ||
4006 | 4062 | ||
4063 | // FIXME: improve logging after this point! | ||
4064 | |||
4007 | /** | 4065 | /** |
4008 | * Pick a queue of @a n under constraints @a options and schedule | 4066 | * Pick a queue of @a n under constraints @a options and schedule |
4009 | * transmission of @a hdr. | 4067 | * transmission of @a hdr. |
@@ -4698,7 +4756,8 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh) | |||
4698 | } | 4756 | } |
4699 | /* FIXME: consider doing this _only_ once the message | 4757 | /* FIXME: consider doing this _only_ once the message |
4700 | was drained from the CORE MQs to extend flow control to CORE! | 4758 | was drained from the CORE MQs to extend flow control to CORE! |
4701 | (basically, increment counter in cmc, decrement on MQ send continuation! */ | 4759 | (basically, increment counter in cmc, decrement on MQ send continuation! |
4760 | */ | ||
4702 | finish_cmc_handling (cmc); | 4761 | finish_cmc_handling (cmc); |
4703 | } | 4762 | } |
4704 | 4763 | ||
@@ -5149,8 +5208,8 @@ update_dvh_performance (struct DistanceVectorHop *dvh, | |||
5149 | * The @a pa was acknowledged, process the acknowledgement. | 5208 | * The @a pa was acknowledged, process the acknowledgement. |
5150 | * | 5209 | * |
5151 | * @param pa the pending acknowledgement that was satisfied | 5210 | * @param pa the pending acknowledgement that was satisfied |
5152 | * @param ack_delay artificial delay from cummulative acks created by the other | 5211 | * @param ack_delay artificial delay from cummulative acks created by the |
5153 | * peer | 5212 | * other peer |
5154 | */ | 5213 | */ |
5155 | static void | 5214 | static void |
5156 | handle_acknowledged (struct PendingAcknowledgement *pa, | 5215 | handle_acknowledged (struct PendingAcknowledgement *pa, |