diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-21 19:45:41 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-21 19:45:41 +0100 |
commit | 742aa628e2045b947a9e55b60b0e976ea6658c9a (patch) | |
tree | eade56d7ee1a30281f94e1af8cec2da57e35e5db /src/cadet/gnunet-service-cadet-new_channel.c | |
parent | 308518cb6fbc4b635fccd87a770f66cc2e2816f3 (diff) | |
download | gnunet-742aa628e2045b947a9e55b60b0e976ea6658c9a.tar.gz gnunet-742aa628e2045b947a9e55b60b0e976ea6658c9a.zip |
more logging, minor bugfixes / renames
Diffstat (limited to 'src/cadet/gnunet-service-cadet-new_channel.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet-new_channel.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/src/cadet/gnunet-service-cadet-new_channel.c b/src/cadet/gnunet-service-cadet-new_channel.c index e64e66dfa..a3ab07c3c 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.c +++ b/src/cadet/gnunet-service-cadet-new_channel.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include "gnunet-service-cadet-new_peer.h" | 44 | #include "gnunet-service-cadet-new_peer.h" |
45 | #include "gnunet-service-cadet-new_paths.h" | 45 | #include "gnunet-service-cadet-new_paths.h" |
46 | 46 | ||
47 | #define LOG(level,...) GNUNET_log_from (level,"cadet-channel",__VA_ARGS__) | 47 | #define LOG(level,...) GNUNET_log_from (level,"cadet-chn",__VA_ARGS__) |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * How long do we initially wait before retransmitting? | 50 | * How long do we initially wait before retransmitting? |
@@ -405,7 +405,7 @@ channel_destroy (struct CadetChannel *ch) | |||
405 | * @param cls Channel for which to send. | 405 | * @param cls Channel for which to send. |
406 | */ | 406 | */ |
407 | static void | 407 | static void |
408 | send_create (void *cls); | 408 | send_channel_open (void *cls); |
409 | 409 | ||
410 | 410 | ||
411 | /** | 411 | /** |
@@ -415,25 +415,25 @@ send_create (void *cls); | |||
415 | * @param cls our `struct CadetChannel`. | 415 | * @param cls our `struct CadetChannel`. |
416 | */ | 416 | */ |
417 | static void | 417 | static void |
418 | create_sent_cb (void *cls) | 418 | channel_open_sent_cb (void *cls) |
419 | { | 419 | { |
420 | struct CadetChannel *ch = cls; | 420 | struct CadetChannel *ch = cls; |
421 | 421 | ||
422 | ch->last_control_qe = NULL; | 422 | ch->last_control_qe = NULL; |
423 | ch->retry_time = GNUNET_TIME_STD_BACKOFF (ch->retry_time); | 423 | ch->retry_time = GNUNET_TIME_STD_BACKOFF (ch->retry_time); |
424 | ch->retry_task = GNUNET_SCHEDULER_add_delayed (ch->retry_time, | 424 | ch->retry_task = GNUNET_SCHEDULER_add_delayed (ch->retry_time, |
425 | &send_create, | 425 | &send_channel_open, |
426 | ch); | 426 | ch); |
427 | } | 427 | } |
428 | 428 | ||
429 | 429 | ||
430 | /** | 430 | /** |
431 | * Send a channel create message. | 431 | * Send a channel open message. |
432 | * | 432 | * |
433 | * @param cls Channel for which to send. | 433 | * @param cls Channel for which to send. |
434 | */ | 434 | */ |
435 | static void | 435 | static void |
436 | send_create (void *cls) | 436 | send_channel_open (void *cls) |
437 | { | 437 | { |
438 | struct CadetChannel *ch = cls; | 438 | struct CadetChannel *ch = cls; |
439 | struct GNUNET_CADET_ChannelOpenMessage msgcc; | 439 | struct GNUNET_CADET_ChannelOpenMessage msgcc; |
@@ -454,8 +454,11 @@ send_create (void *cls) | |||
454 | ch->state = CADET_CHANNEL_CREATE_SENT; | 454 | ch->state = CADET_CHANNEL_CREATE_SENT; |
455 | ch->last_control_qe = GCT_send (ch->t, | 455 | ch->last_control_qe = GCT_send (ch->t, |
456 | &msgcc.header, | 456 | &msgcc.header, |
457 | &create_sent_cb, | 457 | &channel_open_sent_cb, |
458 | ch); | 458 | ch); |
459 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
460 | "Sending CHANNEL_OPEN message for channel %s\n", | ||
461 | GCCH_2s (ch)); | ||
459 | } | 462 | } |
460 | 463 | ||
461 | 464 | ||
@@ -491,7 +494,7 @@ GCCH_channel_local_new (struct CadetClient *owner, | |||
491 | ch->ctn = GCT_add_channel (ch->t, | 494 | ch->ctn = GCT_add_channel (ch->t, |
492 | ch); | 495 | ch); |
493 | ch->retry_time = CADET_INITIAL_RETRANSMIT_TIME; | 496 | ch->retry_time = CADET_INITIAL_RETRANSMIT_TIME; |
494 | ch->retry_task = GNUNET_SCHEDULER_add_now (&send_create, | 497 | ch->retry_task = GNUNET_SCHEDULER_add_now (&send_channel_open, |
495 | ch); | 498 | ch); |
496 | GNUNET_STATISTICS_update (stats, | 499 | GNUNET_STATISTICS_update (stats, |
497 | "# channels", | 500 | "# channels", |
@@ -611,7 +614,7 @@ send_ack_cb (void *cls) | |||
611 | * @param ch channel to send the ACK for | 614 | * @param ch channel to send the ACK for |
612 | */ | 615 | */ |
613 | static void | 616 | static void |
614 | send_channel_ack (struct CadetChannel *ch) | 617 | send_channel_data_ack (struct CadetChannel *ch) |
615 | { | 618 | { |
616 | struct GNUNET_CADET_ChannelDataAckMessage msg; | 619 | struct GNUNET_CADET_ChannelDataAckMessage msg; |
617 | 620 | ||
@@ -641,7 +644,7 @@ send_connect_ack (void *cls) | |||
641 | struct CadetChannel *ch = cls; | 644 | struct CadetChannel *ch = cls; |
642 | 645 | ||
643 | ch->retry_task = NULL; | 646 | ch->retry_task = NULL; |
644 | send_channel_ack (ch); | 647 | send_channel_data_ack (ch); |
645 | } | 648 | } |
646 | 649 | ||
647 | 650 | ||
@@ -792,7 +795,7 @@ GCCH_channel_incoming_destroy (struct CadetChannel *ch) | |||
792 | * @param ch channel to destroy | 795 | * @param ch channel to destroy |
793 | */ | 796 | */ |
794 | void | 797 | void |
795 | GCCH_handle_channel_create_ack (struct CadetChannel *ch) | 798 | GCCH_handle_channel_open_ack (struct CadetChannel *ch) |
796 | { | 799 | { |
797 | switch (ch->state) | 800 | switch (ch->state) |
798 | { | 801 | { |
@@ -807,6 +810,9 @@ GCCH_handle_channel_create_ack (struct CadetChannel *ch) | |||
807 | GNUNET_break_op (0); | 810 | GNUNET_break_op (0); |
808 | return; | 811 | return; |
809 | } | 812 | } |
813 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
814 | "Received channel OPEN_ACK for waiting channel %s, entering READY state\n", | ||
815 | GCCH_2s (ch)); | ||
810 | ch->state = CADET_CHANNEL_READY; | 816 | ch->state = CADET_CHANNEL_READY; |
811 | /* On first connect, send client as many ACKs as we allow messages | 817 | /* On first connect, send client as many ACKs as we allow messages |
812 | to be buffered! */ | 818 | to be buffered! */ |
@@ -816,6 +822,9 @@ GCCH_handle_channel_create_ack (struct CadetChannel *ch) | |||
816 | break; | 822 | break; |
817 | case CADET_CHANNEL_READY: | 823 | case CADET_CHANNEL_READY: |
818 | /* duplicate ACK, maybe we retried the CREATE. Ignore. */ | 824 | /* duplicate ACK, maybe we retried the CREATE. Ignore. */ |
825 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
826 | "Received duplicate channel OPEN_ACK for channel %s\n", | ||
827 | GCCH_2s (ch)); | ||
819 | GNUNET_STATISTICS_update (stats, | 828 | GNUNET_STATISTICS_update (stats, |
820 | "# duplicate CREATE_ACKs", | 829 | "# duplicate CREATE_ACKs", |
821 | 1, | 830 | 1, |
@@ -876,6 +885,10 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel *ch, | |||
876 | size_t payload_size; | 885 | size_t payload_size; |
877 | 886 | ||
878 | payload_size = ntohs (msg->header.size) - sizeof (*msg); | 887 | payload_size = ntohs (msg->header.size) - sizeof (*msg); |
888 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
889 | "Receicved %u bytes of application data on channel %s\n", | ||
890 | (unsigned int) payload_size, | ||
891 | GCCH_2s (ch)); | ||
879 | env = GNUNET_MQ_msg_extra (ld, | 892 | env = GNUNET_MQ_msg_extra (ld, |
880 | payload_size, | 893 | payload_size, |
881 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); | 894 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); |
@@ -966,7 +979,7 @@ GCCH_handle_channel_plaintext_data_ack (struct CadetChannel *ch, | |||
966 | /* ACK for message we already dropped, might have been a | 979 | /* ACK for message we already dropped, might have been a |
967 | duplicate ACK? Ignore. */ | 980 | duplicate ACK? Ignore. */ |
968 | GNUNET_STATISTICS_update (stats, | 981 | GNUNET_STATISTICS_update (stats, |
969 | "# duplicate CHANNEL_DATA_ACKs", | 982 | "# duplicate DATA_ACKs", |
970 | 1, | 983 | 1, |
971 | GNUNET_NO); | 984 | GNUNET_NO); |
972 | return; | 985 | return; |
@@ -995,6 +1008,9 @@ GCCH_handle_remote_destroy (struct CadetChannel *ch) | |||
995 | struct GNUNET_MQ_Envelope *env; | 1008 | struct GNUNET_MQ_Envelope *env; |
996 | struct GNUNET_CADET_LocalChannelDestroyMessage *tdm; | 1009 | struct GNUNET_CADET_LocalChannelDestroyMessage *tdm; |
997 | 1010 | ||
1011 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1012 | "Received remote channel DESTROY for channel %s\n", | ||
1013 | GCCH_2s (ch)); | ||
998 | ch->destroy = GNUNET_YES; | 1014 | ch->destroy = GNUNET_YES; |
999 | env = GNUNET_MQ_msg (tdm, | 1015 | env = GNUNET_MQ_msg (tdm, |
1000 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY); | 1016 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY); |
@@ -1255,7 +1271,7 @@ send_client_buffered_data (struct CadetChannel *ch) | |||
1255 | "Sender on channel %s likely blocked on flow-control, sending ACK now.\n", | 1271 | "Sender on channel %s likely blocked on flow-control, sending ACK now.\n", |
1256 | GCCH_2s (ch)); | 1272 | GCCH_2s (ch)); |
1257 | if (GNUNET_YES == ch->reliable) | 1273 | if (GNUNET_YES == ch->reliable) |
1258 | send_channel_ack (ch); | 1274 | send_channel_data_ack (ch); |
1259 | } | 1275 | } |
1260 | 1276 | ||
1261 | if (NULL != ch->head_recv) | 1277 | if (NULL != ch->head_recv) |