diff options
author | Bart Polot <bart.polot+gnunet@gmail.com> | 2017-03-01 18:49:52 +0100 |
---|---|---|
committer | Bart Polot <bart.polot+gnunet@gmail.com> | 2017-03-01 18:49:52 +0100 |
commit | 466f3fe3101c78f5219b63ca8724697757104d87 (patch) | |
tree | 82330dfdd06af141930e64894387d192124c3c47 /src/cadet | |
parent | cef53c8a38a628335e85dbf16c261cccc58512c5 (diff) | |
parent | 13b340c41157eb7d1d37e2d16058ce791a7c768e (diff) | |
download | gnunet-466f3fe3101c78f5219b63ca8724697757104d87.tar.gz gnunet-466f3fe3101c78f5219b63ca8724697757104d87.zip |
Merge branch 'master' of git+ssh://gnunet.org/gnunet
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/cadet_api_new.c | 27 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet-new.c | 20 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet-new_channel.c | 10 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet-new_tunnels.c | 12 |
4 files changed, 37 insertions, 32 deletions
diff --git a/src/cadet/cadet_api_new.c b/src/cadet/cadet_api_new.c index a62de0a47..2d5d853b3 100644 --- a/src/cadet/cadet_api_new.c +++ b/src/cadet/cadet_api_new.c | |||
@@ -626,7 +626,6 @@ handle_channel_created (void *cls, | |||
626 | struct GNUNET_CADET_LocalChannelDestroyMessage *d_msg; | 626 | struct GNUNET_CADET_LocalChannelDestroyMessage *d_msg; |
627 | struct GNUNET_MQ_Envelope *env; | 627 | struct GNUNET_MQ_Envelope *env; |
628 | 628 | ||
629 | GNUNET_break (0); | ||
630 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 629 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
631 | "No handler for incoming channel %X (on port %s, recently closed?)\n", | 630 | "No handler for incoming channel %X (on port %s, recently closed?)\n", |
632 | ntohl (ccn.channel_of_client), | 631 | ntohl (ccn.channel_of_client), |
@@ -682,16 +681,18 @@ handle_channel_destroy (void *cls, | |||
682 | struct GNUNET_CADET_Handle *h = cls; | 681 | struct GNUNET_CADET_Handle *h = cls; |
683 | struct GNUNET_CADET_Channel *ch; | 682 | struct GNUNET_CADET_Channel *ch; |
684 | 683 | ||
685 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
686 | "Received channel destroy for channel %X from CADET service\n", | ||
687 | ntohl (msg->ccn.channel_of_client)); | ||
688 | ch = find_channel (h, | 684 | ch = find_channel (h, |
689 | msg->ccn); | 685 | msg->ccn); |
690 | if (NULL == ch) | 686 | if (NULL == ch) |
691 | { | 687 | { |
692 | GNUNET_break (0); | 688 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
689 | "Received channel destroy for unknown channel %X from CADET service (recently close?)\n", | ||
690 | ntohl (msg->ccn.channel_of_client)); | ||
693 | return; | 691 | return; |
694 | } | 692 | } |
693 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
694 | "Received channel destroy for channel %X from CADET service\n", | ||
695 | ntohl (msg->ccn.channel_of_client)); | ||
695 | destroy_channel (ch); | 696 | destroy_channel (ch); |
696 | } | 697 | } |
697 | 698 | ||
@@ -708,8 +709,6 @@ static int | |||
708 | check_local_data (void *cls, | 709 | check_local_data (void *cls, |
709 | const struct GNUNET_CADET_LocalData *message) | 710 | const struct GNUNET_CADET_LocalData *message) |
710 | { | 711 | { |
711 | struct GNUNET_CADET_Handle *h = cls; | ||
712 | struct GNUNET_CADET_Channel *ch; | ||
713 | uint16_t size; | 712 | uint16_t size; |
714 | 713 | ||
715 | size = ntohs (message->header.size); | 714 | size = ntohs (message->header.size); |
@@ -718,15 +717,6 @@ check_local_data (void *cls, | |||
718 | GNUNET_break (0); | 717 | GNUNET_break (0); |
719 | return GNUNET_SYSERR; | 718 | return GNUNET_SYSERR; |
720 | } | 719 | } |
721 | |||
722 | ch = find_channel (h, | ||
723 | message->ccn); | ||
724 | if (NULL == ch) | ||
725 | { | ||
726 | GNUNET_break (0); | ||
727 | return GNUNET_SYSERR; | ||
728 | } | ||
729 | |||
730 | return GNUNET_OK; | 720 | return GNUNET_OK; |
731 | } | 721 | } |
732 | 722 | ||
@@ -751,8 +741,9 @@ handle_local_data (void *cls, | |||
751 | message->ccn); | 741 | message->ccn); |
752 | if (NULL == ch) | 742 | if (NULL == ch) |
753 | { | 743 | { |
754 | GNUNET_break (0); | 744 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
755 | reconnect (h); | 745 | "Unknown channel %X for incoming data (recently closed?)\n", |
746 | ntohl (message->ccn.channel_of_client)); | ||
756 | return; | 747 | return; |
757 | } | 748 | } |
758 | 749 | ||
diff --git a/src/cadet/gnunet-service-cadet-new.c b/src/cadet/gnunet-service-cadet-new.c index b0a818c7c..93f53de4c 100644 --- a/src/cadet/gnunet-service-cadet-new.c +++ b/src/cadet/gnunet-service-cadet-new.c | |||
@@ -716,12 +716,18 @@ handle_local_data (void *cls, | |||
716 | msg->ccn); | 716 | msg->ccn); |
717 | if (NULL == ch) | 717 | if (NULL == ch) |
718 | { | 718 | { |
719 | /* Channel does not exist! */ | 719 | /* Channel does not exist (anymore) */ |
720 | GNUNET_break (0); | 720 | LOG (GNUNET_ERROR_TYPE_WARNING, |
721 | GNUNET_SERVICE_client_drop (c->client); | 721 | "Dropping payload for channel %u from client (channel unknown, other endpoint may have disconnected)\n", |
722 | (unsigned int) ntohl (msg->ccn.channel_of_client)); | ||
723 | GNUNET_SERVICE_client_continue (c->client); | ||
722 | return; | 724 | return; |
723 | } | 725 | } |
724 | payload_size = ntohs (msg->header.size) - sizeof (*msg); | 726 | payload_size = ntohs (msg->header.size) - sizeof (*msg); |
727 | GNUNET_STATISTICS_update (stats, | ||
728 | "# payload received from clients", | ||
729 | payload_size, | ||
730 | GNUNET_NO); | ||
725 | buf = (const char *) &msg[1]; | 731 | buf = (const char *) &msg[1]; |
726 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 732 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
727 | "Received %u bytes payload from %s for %s\n", | 733 | "Received %u bytes payload from %s for %s\n", |
@@ -758,9 +764,11 @@ handle_local_ack (void *cls, | |||
758 | msg->ccn); | 764 | msg->ccn); |
759 | if (NULL == ch) | 765 | if (NULL == ch) |
760 | { | 766 | { |
761 | /* Channel does not exist! */ | 767 | /* Channel does not exist (anymore) */ |
762 | GNUNET_break (0); | 768 | LOG (GNUNET_ERROR_TYPE_WARNING, |
763 | GNUNET_SERVICE_client_drop (c->client); | 769 | "Ignoring local ACK for channel %u from client (channel unknown, other endpoint may have disconnected)\n", |
770 | (unsigned int) ntohl (msg->ccn.channel_of_client)); | ||
771 | GNUNET_SERVICE_client_continue (c->client); | ||
764 | return; | 772 | return; |
765 | } | 773 | } |
766 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 774 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/cadet/gnunet-service-cadet-new_channel.c b/src/cadet/gnunet-service-cadet-new_channel.c index c418893a8..8769601c2 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.c +++ b/src/cadet/gnunet-service-cadet-new_channel.c | |||
@@ -1618,7 +1618,8 @@ GCCH_handle_remote_destroy (struct CadetChannel *ch, | |||
1618 | return; | 1618 | return; |
1619 | } | 1619 | } |
1620 | ccc = (NULL != ch->owner) ? ch->owner : ch->dest; | 1620 | ccc = (NULL != ch->owner) ? ch->owner : ch->dest; |
1621 | if (NULL != ccc->head_recv) | 1621 | if ( (NULL != ccc) && |
1622 | (NULL != ccc->head_recv) ) | ||
1622 | { | 1623 | { |
1623 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1624 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1624 | "Lost end of transmission due to remote shutdown on %s\n", | 1625 | "Lost end of transmission due to remote shutdown on %s\n", |
@@ -1626,9 +1627,10 @@ GCCH_handle_remote_destroy (struct CadetChannel *ch, | |||
1626 | /* FIXME: change API to notify client about truncated transmission! */ | 1627 | /* FIXME: change API to notify client about truncated transmission! */ |
1627 | } | 1628 | } |
1628 | ch->destroy = GNUNET_YES; | 1629 | ch->destroy = GNUNET_YES; |
1629 | GSC_handle_remote_channel_destroy (ccc->c, | 1630 | if (NULL != ccc) |
1630 | ccc->ccn, | 1631 | GSC_handle_remote_channel_destroy (ccc->c, |
1631 | ch); | 1632 | ccc->ccn, |
1633 | ch); | ||
1632 | channel_destroy (ch); | 1634 | channel_destroy (ch); |
1633 | } | 1635 | } |
1634 | 1636 | ||
diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c b/src/cadet/gnunet-service-cadet-new_tunnels.c index bf05fae6b..d50860629 100644 --- a/src/cadet/gnunet-service-cadet-new_tunnels.c +++ b/src/cadet/gnunet-service-cadet-new_tunnels.c | |||
@@ -3082,10 +3082,6 @@ GCT_handle_encrypted (struct CadetTConnection *ct, | |||
3082 | break; | 3082 | break; |
3083 | } | 3083 | } |
3084 | 3084 | ||
3085 | GNUNET_STATISTICS_update (stats, | ||
3086 | "# received encrypted", | ||
3087 | 1, | ||
3088 | GNUNET_NO); | ||
3089 | decrypted_size = -1; | 3085 | decrypted_size = -1; |
3090 | if (CADET_TUNNEL_KEY_OK == t->estate) | 3086 | if (CADET_TUNNEL_KEY_OK == t->estate) |
3091 | { | 3087 | { |
@@ -3166,6 +3162,10 @@ GCT_handle_encrypted (struct CadetTConnection *ct, | |||
3166 | &t->ax); | 3162 | &t->ax); |
3167 | return; | 3163 | return; |
3168 | } | 3164 | } |
3165 | GNUNET_STATISTICS_update (stats, | ||
3166 | "# decrypted bytes", | ||
3167 | decrypted_size, | ||
3168 | GNUNET_NO); | ||
3169 | 3169 | ||
3170 | /* The MST will ultimately call #handle_decrypted() on each message. */ | 3170 | /* The MST will ultimately call #handle_decrypted() on each message. */ |
3171 | t->current_ct = ct; | 3171 | t->current_ct = ct; |
@@ -3217,6 +3217,10 @@ GCT_send (struct CadetTunnel *t, | |||
3217 | &ax_msg[1], | 3217 | &ax_msg[1], |
3218 | message, | 3218 | message, |
3219 | payload_size); | 3219 | payload_size); |
3220 | GNUNET_STATISTICS_update (stats, | ||
3221 | "# encrypted bytes", | ||
3222 | payload_size, | ||
3223 | GNUNET_NO); | ||
3220 | ax_msg->ax_header.Ns = htonl (t->ax.Ns++); | 3224 | ax_msg->ax_header.Ns = htonl (t->ax.Ns++); |
3221 | ax_msg->ax_header.PNs = htonl (t->ax.PNs); | 3225 | ax_msg->ax_header.PNs = htonl (t->ax.PNs); |
3222 | /* FIXME: we should do this once, not once per message; | 3226 | /* FIXME: we should do this once, not once per message; |