diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-23 23:17:38 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-23 23:17:38 +0100 |
commit | 3ceefffec0e038099c3fabfea70d0f9202e298d2 (patch) | |
tree | 058292889daceef41f0a0a01b5c62651c5742978 /src/cadet | |
parent | 5c1ac597f1d1f532136dcf678d7eb5575224aa6b (diff) | |
download | gnunet-3ceefffec0e038099c3fabfea70d0f9202e298d2.tar.gz gnunet-3ceefffec0e038099c3fabfea70d0f9202e298d2.zip |
avoid cmp pointers, cmp ccn instead, as client may literally be the same
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/cadet.h | 2 | ||||
-rw-r--r-- | src/cadet/cadet_api.c | 68 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet-new.c | 7 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet-new_channel.c | 58 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet-new_channel.h | 4 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet-new_tunnels.c | 2 |
6 files changed, 82 insertions, 59 deletions
diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h index 97372cb80..451d1f354 100644 --- a/src/cadet/cadet.h +++ b/src/cadet/cadet.h | |||
@@ -68,7 +68,7 @@ extern "C" | |||
68 | /** | 68 | /** |
69 | * Minimum value for channel IDs of local clients. | 69 | * Minimum value for channel IDs of local clients. |
70 | */ | 70 | */ |
71 | #define GNUNET_CADET_LOCAL_CHANNEL_ID_CLI 0x80000000 | 71 | #define GNUNET_CADET_LOCAL_CHANNEL_ID_CLI 0x80000000U |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * FIXME. | 74 | * FIXME. |
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index de10d5809..53a954810 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c | |||
@@ -558,8 +558,9 @@ request_data (void *cls) | |||
558 | size_t osize; | 558 | size_t osize; |
559 | 559 | ||
560 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 560 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
561 | "Requesting Data: %u bytes\n", | 561 | "Requesting Data: %u bytes (allow send is %u)\n", |
562 | th->size); | 562 | th->size, |
563 | th->channel->allow_send); | ||
563 | 564 | ||
564 | GNUNET_assert (0 < th->channel->allow_send); | 565 | GNUNET_assert (0 < th->channel->allow_send); |
565 | th->channel->allow_send--; | 566 | th->channel->allow_send--; |
@@ -727,41 +728,34 @@ handle_local_data (void *cls, | |||
727 | unsigned int i; | 728 | unsigned int i; |
728 | uint16_t type; | 729 | uint16_t type; |
729 | 730 | ||
730 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
731 | "Got a data message!\n"); | ||
732 | ch = retrieve_channel (h, | 731 | ch = retrieve_channel (h, |
733 | message->ccn); | 732 | message->ccn); |
734 | GNUNET_assert (NULL != ch); | 733 | GNUNET_assert (NULL != ch); |
735 | 734 | ||
736 | payload = (struct GNUNET_MessageHeader *) &message[1]; | 735 | payload = (struct GNUNET_MessageHeader *) &message[1]; |
737 | LOG (GNUNET_ERROR_TYPE_DEBUG, " %s data on channel %s [%X]\n", | 736 | type = ntohs (payload->type); |
737 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
738 | "Got a %s data on channel %s [%X] of type %s\n", | ||
738 | GC_f2s (ntohl (ch->ccn.channel_of_client) >= | 739 | GC_f2s (ntohl (ch->ccn.channel_of_client) >= |
739 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI), | 740 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI), |
740 | GNUNET_i2s (GNUNET_PEER_resolve2 (ch->peer)), | 741 | GNUNET_i2s (GNUNET_PEER_resolve2 (ch->peer)), |
741 | ntohl (message->ccn.channel_of_client)); | 742 | ntohl (message->ccn.channel_of_client), |
743 | GC_m2s (type)); | ||
742 | 744 | ||
743 | type = ntohs (payload->type); | ||
744 | LOG (GNUNET_ERROR_TYPE_DEBUG, " payload type %s\n", GC_m2s (type)); | ||
745 | for (i = 0; i < h->n_handlers; i++) | 745 | for (i = 0; i < h->n_handlers; i++) |
746 | { | 746 | { |
747 | handler = &h->message_handlers[i]; | 747 | handler = &h->message_handlers[i]; |
748 | LOG (GNUNET_ERROR_TYPE_DEBUG, " checking handler for type %u\n", | ||
749 | handler->type); | ||
750 | if (handler->type == type) | 748 | if (handler->type == type) |
751 | { | 749 | { |
752 | if (GNUNET_OK != | 750 | if (GNUNET_OK != |
753 | handler->callback (h->cls, ch, &ch->ctx, payload)) | 751 | handler->callback (h->cls, ch, &ch->ctx, payload)) |
754 | { | 752 | { |
755 | LOG (GNUNET_ERROR_TYPE_DEBUG, "callback caused disconnection\n"); | ||
756 | GNUNET_CADET_channel_destroy (ch); | ||
757 | break; | ||
758 | } | ||
759 | else | ||
760 | { | ||
761 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 753 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
762 | "callback completed successfully\n"); | 754 | "callback caused disconnection\n"); |
755 | GNUNET_CADET_channel_destroy (ch); | ||
763 | break; | 756 | break; |
764 | } | 757 | } |
758 | break; | ||
765 | } | 759 | } |
766 | } | 760 | } |
767 | } | 761 | } |
@@ -792,12 +786,11 @@ handle_local_ack (void *cls, | |||
792 | ntohl (ccn.channel_of_client)); | 786 | ntohl (ccn.channel_of_client)); |
793 | return; | 787 | return; |
794 | } | 788 | } |
795 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
796 | "Got an ACK on channel %X!\n", | ||
797 | ntohl (ch->ccn.channel_of_client)); | ||
798 | ch->allow_send++; | 789 | ch->allow_send++; |
799 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 790 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
800 | "Checking for pending data\n"); | 791 | "Got an ACK on channel %X, allow send now %u!\n", |
792 | ntohl (ch->ccn.channel_of_client), | ||
793 | ch->allow_send); | ||
801 | for (th = h->th_head; NULL != th; th = th->next) | 794 | for (th = h->th_head; NULL != th; th = th->next) |
802 | { | 795 | { |
803 | if ( (th->channel == ch) && | 796 | if ( (th->channel == ch) && |
@@ -1269,8 +1262,7 @@ handle_get_tunnel (void *cls, | |||
1269 | * original state. | 1262 | * original state. |
1270 | * | 1263 | * |
1271 | * @param h handle to the cadet | 1264 | * @param h handle to the cadet |
1272 | * | 1265 | * @return #GNUNET_YES in case of success, #GNUNET_NO otherwise (service down...) |
1273 | * @return GNUNET_YES in case of sucess, GNUNET_NO otherwise (service down...) | ||
1274 | */ | 1266 | */ |
1275 | static int | 1267 | static int |
1276 | do_reconnect (struct GNUNET_CADET_Handle *h) | 1268 | do_reconnect (struct GNUNET_CADET_Handle *h) |
@@ -1701,17 +1693,17 @@ GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel, | |||
1701 | struct GNUNET_CADET_TransmitHandle *th; | 1693 | struct GNUNET_CADET_TransmitHandle *th; |
1702 | 1694 | ||
1703 | GNUNET_assert (NULL != channel); | 1695 | GNUNET_assert (NULL != channel); |
1704 | GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= notify_size); | ||
1705 | LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET NOTIFY TRANSMIT READY\n"); | ||
1706 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", channel->ccn); | ||
1707 | LOG (GNUNET_ERROR_TYPE_DEBUG, " allow_send %d\n", channel->allow_send); | ||
1708 | if (ntohl (channel->ccn.channel_of_client) >= | ||
1709 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) | ||
1710 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to origin\n"); | ||
1711 | else | ||
1712 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to destination\n"); | ||
1713 | LOG (GNUNET_ERROR_TYPE_DEBUG, " payload size %u\n", notify_size); | ||
1714 | GNUNET_assert (NULL != notify); | 1696 | GNUNET_assert (NULL != notify); |
1697 | GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= notify_size); | ||
1698 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1699 | "CADET NOTIFY TRANSMIT READY on channel %X allow_send is %u to %s with %u bytes\n", | ||
1700 | channel->ccn, | ||
1701 | channel->allow_send, | ||
1702 | (ntohl (channel->ccn.channel_of_client) >= | ||
1703 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) | ||
1704 | ? "origin" | ||
1705 | : "destination", | ||
1706 | (unsigned int) notify_size); | ||
1715 | if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != maxdelay.rel_value_us) | 1707 | if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != maxdelay.rel_value_us) |
1716 | { | 1708 | { |
1717 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1709 | LOG (GNUNET_ERROR_TYPE_WARNING, |
@@ -1721,15 +1713,15 @@ GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel, | |||
1721 | th = GNUNET_new (struct GNUNET_CADET_TransmitHandle); | 1713 | th = GNUNET_new (struct GNUNET_CADET_TransmitHandle); |
1722 | th->channel = channel; | 1714 | th->channel = channel; |
1723 | th->size = notify_size; | 1715 | th->size = notify_size; |
1724 | LOG (GNUNET_ERROR_TYPE_DEBUG, " total size %u\n", th->size); | ||
1725 | th->notify = notify; | 1716 | th->notify = notify; |
1726 | th->notify_cls = notify_cls; | 1717 | th->notify_cls = notify_cls; |
1727 | if (0 != channel->allow_send) | 1718 | if (0 != channel->allow_send) |
1728 | th->request_data_task = GNUNET_SCHEDULER_add_now (&request_data, th); | 1719 | th->request_data_task |
1720 | = GNUNET_SCHEDULER_add_now (&request_data, | ||
1721 | th); | ||
1729 | else | 1722 | else |
1730 | add_to_queue (channel->cadet, th); | 1723 | add_to_queue (channel->cadet, |
1731 | 1724 | th); | |
1732 | LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET NOTIFY TRANSMIT READY END\n"); | ||
1733 | return th; | 1725 | return th; |
1734 | } | 1726 | } |
1735 | 1727 | ||
diff --git a/src/cadet/gnunet-service-cadet-new.c b/src/cadet/gnunet-service-cadet-new.c index 441511e45..d2c49db15 100644 --- a/src/cadet/gnunet-service-cadet-new.c +++ b/src/cadet/gnunet-service-cadet-new.c | |||
@@ -292,11 +292,12 @@ GSC_bind (struct CadetClient *c, | |||
292 | ch, | 292 | ch, |
293 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 293 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
294 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 294 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
295 | "Accepting incoming %s from %s on open port %s (%u)\n", | 295 | "Accepting incoming %s from %s on open port %s (%u), assigning ccn %X\n", |
296 | GCCH_2s (ch), | 296 | GCCH_2s (ch), |
297 | GCP_2s (dest), | 297 | GCP_2s (dest), |
298 | GNUNET_h2s (port), | 298 | GNUNET_h2s (port), |
299 | ntohl (options)); | 299 | ntohl (options), |
300 | ntohl (ccn.channel_of_client)); | ||
300 | /* notify local client about incoming connection! */ | 301 | /* notify local client about incoming connection! */ |
301 | env = GNUNET_MQ_msg (cm, | 302 | env = GNUNET_MQ_msg (cm, |
302 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE); | 303 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE); |
@@ -715,7 +716,7 @@ handle_data (void *cls, | |||
715 | GCCH_2s (ch)); | 716 | GCCH_2s (ch)); |
716 | if (GNUNET_OK != | 717 | if (GNUNET_OK != |
717 | GCCH_handle_local_data (ch, | 718 | GCCH_handle_local_data (ch, |
718 | c, | 719 | msg->ccn, |
719 | buf, | 720 | buf, |
720 | payload_size)) | 721 | payload_size)) |
721 | { | 722 | { |
diff --git a/src/cadet/gnunet-service-cadet-new_channel.c b/src/cadet/gnunet-service-cadet-new_channel.c index 0d2545fb4..e11616af7 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.c +++ b/src/cadet/gnunet-service-cadet-new_channel.c | |||
@@ -537,7 +537,7 @@ GCCH_channel_local_new (struct CadetClient *owner, | |||
537 | ch->nobuffer = (0 != (options & GNUNET_CADET_OPTION_NOBUFFER)); | 537 | ch->nobuffer = (0 != (options & GNUNET_CADET_OPTION_NOBUFFER)); |
538 | ch->reliable = (0 != (options & GNUNET_CADET_OPTION_RELIABLE)); | 538 | ch->reliable = (0 != (options & GNUNET_CADET_OPTION_RELIABLE)); |
539 | ch->out_of_order = (0 != (options & GNUNET_CADET_OPTION_OUT_OF_ORDER)); | 539 | ch->out_of_order = (0 != (options & GNUNET_CADET_OPTION_OUT_OF_ORDER)); |
540 | ch->max_pending_messages = (ch->nobuffer) ? 1 : 32; /* FIXME: 32!? Do not hardcode! */ | 540 | ch->max_pending_messages = (ch->nobuffer) ? 1 : 4; /* FIXME: 4!? Do not hardcode! */ |
541 | ch->owner = owner; | 541 | ch->owner = owner; |
542 | ch->ccn_owner = ccn; | 542 | ch->ccn_owner = ccn; |
543 | ch->port = *port; | 543 | ch->port = *port; |
@@ -633,7 +633,7 @@ GCCH_channel_incoming_new (struct CadetTunnel *t, | |||
633 | ch->nobuffer = (0 != (options & GNUNET_CADET_OPTION_NOBUFFER)); | 633 | ch->nobuffer = (0 != (options & GNUNET_CADET_OPTION_NOBUFFER)); |
634 | ch->reliable = (0 != (options & GNUNET_CADET_OPTION_RELIABLE)); | 634 | ch->reliable = (0 != (options & GNUNET_CADET_OPTION_RELIABLE)); |
635 | ch->out_of_order = (0 != (options & GNUNET_CADET_OPTION_OUT_OF_ORDER)); | 635 | ch->out_of_order = (0 != (options & GNUNET_CADET_OPTION_OUT_OF_ORDER)); |
636 | ch->max_pending_messages = (ch->nobuffer) ? 1 : 32; /* FIXME: 32!? Do not hardcode! */ | 636 | ch->max_pending_messages = (ch->nobuffer) ? 1 : 4; /* FIXME: 4!? Do not hardcode! */ |
637 | GNUNET_STATISTICS_update (stats, | 637 | GNUNET_STATISTICS_update (stats, |
638 | "# channels", | 638 | "# channels", |
639 | 1, | 639 | 1, |
@@ -774,21 +774,31 @@ GCCH_handle_duplicate_open (struct CadetChannel *ch) | |||
774 | 774 | ||
775 | 775 | ||
776 | /** | 776 | /** |
777 | * Send a #GNUNET_MESSAGE_TYPE_CADET_LOCAL ACK to the client to solicit more messages. | 777 | * Send a #GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK to the client to solicit more messages. |
778 | * | 778 | * |
779 | * @param ch channel the ack is for | 779 | * @param ch channel the ack is for |
780 | * @param c client to send the ACK to | 780 | * @param to_owner #GNUNET_YES to send to owner, |
781 | * #GNUNET_NO to send to dest | ||
781 | */ | 782 | */ |
782 | static void | 783 | static void |
783 | send_ack_to_client (struct CadetChannel *ch, | 784 | send_ack_to_client (struct CadetChannel *ch, |
784 | struct CadetClient *c) | 785 | int to_owner) |
785 | { | 786 | { |
786 | struct GNUNET_MQ_Envelope *env; | 787 | struct GNUNET_MQ_Envelope *env; |
787 | struct GNUNET_CADET_LocalAck *ack; | 788 | struct GNUNET_CADET_LocalAck *ack; |
789 | struct CadetClient *c; | ||
788 | 790 | ||
789 | env = GNUNET_MQ_msg (ack, | 791 | env = GNUNET_MQ_msg (ack, |
790 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK); | 792 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK); |
791 | ack->ccn = (c == ch->owner) ? ch->ccn_owner : ch->ccn_dest; | 793 | ack->ccn = (GNUNET_YES == to_owner) ? ch->ccn_owner : ch->ccn_dest; |
794 | c = (GNUNET_YES == to_owner) | ||
795 | ? ch->owner | ||
796 | : ch->dest; | ||
797 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
798 | "Sending CADET_LOCAL_ACK to %s (%s) at ccn %X\n", | ||
799 | GSC_2s (c), | ||
800 | (GNUNET_YES == to_owner) ? "owner" : "dest", | ||
801 | ntohl (ack->ccn.channel_of_client)); | ||
792 | GSC_send_to_client (c, | 802 | GSC_send_to_client (c, |
793 | env); | 803 | env); |
794 | } | 804 | } |
@@ -836,6 +846,8 @@ GCCH_bind (struct CadetChannel *ch, | |||
836 | : GCT_get_destination (ch->t), | 846 | : GCT_get_destination (ch->t), |
837 | &ch->port, | 847 | &ch->port, |
838 | options); | 848 | options); |
849 | GNUNET_assert (ntohl (ch->ccn_dest.channel_of_client) < | ||
850 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); | ||
839 | ch->mid_recv.mid = htonl (1); /* The CONNECT counts as message 0! */ | 851 | ch->mid_recv.mid = htonl (1); /* The CONNECT counts as message 0! */ |
840 | if (GNUNET_YES == ch->is_loopback) | 852 | if (GNUNET_YES == ch->is_loopback) |
841 | { | 853 | { |
@@ -850,9 +862,11 @@ GCCH_bind (struct CadetChannel *ch, | |||
850 | ch); | 862 | ch); |
851 | } | 863 | } |
852 | /* give client it's initial supply of ACKs */ | 864 | /* give client it's initial supply of ACKs */ |
865 | GNUNET_assert (ntohl (ch->ccn_dest.channel_of_client) < | ||
866 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); | ||
853 | for (unsigned int i=0;i<ch->max_pending_messages;i++) | 867 | for (unsigned int i=0;i<ch->max_pending_messages;i++) |
854 | send_ack_to_client (ch, | 868 | send_ack_to_client (ch, |
855 | ch->dest); | 869 | GNUNET_NO); |
856 | } | 870 | } |
857 | 871 | ||
858 | 872 | ||
@@ -938,7 +952,7 @@ GCCH_handle_channel_open_ack (struct CadetChannel *ch) | |||
938 | to be buffered! */ | 952 | to be buffered! */ |
939 | for (unsigned int i=0;i<ch->max_pending_messages;i++) | 953 | for (unsigned int i=0;i<ch->max_pending_messages;i++) |
940 | send_ack_to_client (ch, | 954 | send_ack_to_client (ch, |
941 | ch->owner); | 955 | GNUNET_YES); |
942 | break; | 956 | break; |
943 | case CADET_CHANNEL_READY: | 957 | case CADET_CHANNEL_READY: |
944 | /* duplicate ACK, maybe we retried the CREATE. Ignore. */ | 958 | /* duplicate ACK, maybe we retried the CREATE. Ignore. */ |
@@ -1121,7 +1135,9 @@ GCCH_handle_channel_plaintext_data_ack (struct CadetChannel *ch, | |||
1121 | (unsigned int) ntohl (ack->mid.mid), | 1135 | (unsigned int) ntohl (ack->mid.mid), |
1122 | ch->pending_messages); | 1136 | ch->pending_messages); |
1123 | send_ack_to_client (ch, | 1137 | send_ack_to_client (ch, |
1124 | (NULL == ch->owner) ? ch->dest : ch->owner); | 1138 | (NULL == ch->owner) |
1139 | ? GNUNET_NO | ||
1140 | : GNUNET_YES); | ||
1125 | } | 1141 | } |
1126 | 1142 | ||
1127 | 1143 | ||
@@ -1316,7 +1332,7 @@ data_sent_cb (void *cls) | |||
1316 | * buffer space in the tunnel. | 1332 | * buffer space in the tunnel. |
1317 | * | 1333 | * |
1318 | * @param ch Channel. | 1334 | * @param ch Channel. |
1319 | * @param sender client sending the data | 1335 | * @param sender_ccn ccn of the sender |
1320 | * @param buf payload to transmit. | 1336 | * @param buf payload to transmit. |
1321 | * @param buf_len number of bytes in @a buf | 1337 | * @param buf_len number of bytes in @a buf |
1322 | * @return #GNUNET_OK if everything goes well, | 1338 | * @return #GNUNET_OK if everything goes well, |
@@ -1324,7 +1340,7 @@ data_sent_cb (void *cls) | |||
1324 | */ | 1340 | */ |
1325 | int | 1341 | int |
1326 | GCCH_handle_local_data (struct CadetChannel *ch, | 1342 | GCCH_handle_local_data (struct CadetChannel *ch, |
1327 | struct CadetClient *sender, | 1343 | struct GNUNET_CADET_ClientChannelNumber sender_ccn, |
1328 | const char *buf, | 1344 | const char *buf, |
1329 | size_t buf_len) | 1345 | size_t buf_len) |
1330 | { | 1346 | { |
@@ -1342,12 +1358,26 @@ GCCH_handle_local_data (struct CadetChannel *ch, | |||
1342 | struct CadetClient *receiver; | 1358 | struct CadetClient *receiver; |
1343 | struct GNUNET_MQ_Envelope *env; | 1359 | struct GNUNET_MQ_Envelope *env; |
1344 | struct GNUNET_CADET_LocalData *ld; | 1360 | struct GNUNET_CADET_LocalData *ld; |
1361 | int to_owner; | ||
1345 | 1362 | ||
1346 | env = GNUNET_MQ_msg_extra (ld, | 1363 | env = GNUNET_MQ_msg_extra (ld, |
1347 | buf_len, | 1364 | buf_len, |
1348 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); | 1365 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); |
1349 | receiver = (ch->owner == sender) ? ch->dest : ch->owner; | 1366 | if (sender_ccn.channel_of_client == |
1350 | ld->ccn = (ch->owner == sender) ? ch->ccn_dest : ch->ccn_owner; | 1367 | ch->ccn_owner.channel_of_client) |
1368 | { | ||
1369 | receiver = ch->dest; | ||
1370 | ld->ccn = ch->ccn_dest; | ||
1371 | to_owner = GNUNET_NO; | ||
1372 | } | ||
1373 | else | ||
1374 | { | ||
1375 | GNUNET_assert (sender_ccn.channel_of_client == | ||
1376 | ch->ccn_dest.channel_of_client); | ||
1377 | receiver = ch->owner; | ||
1378 | ld->ccn = ch->ccn_owner; | ||
1379 | to_owner = GNUNET_YES; | ||
1380 | } | ||
1351 | GNUNET_memcpy (&ld[1], | 1381 | GNUNET_memcpy (&ld[1], |
1352 | buf, | 1382 | buf, |
1353 | buf_len); | 1383 | buf_len); |
@@ -1355,7 +1385,7 @@ GCCH_handle_local_data (struct CadetChannel *ch, | |||
1355 | GSC_send_to_client (receiver, | 1385 | GSC_send_to_client (receiver, |
1356 | env); | 1386 | env); |
1357 | send_ack_to_client (ch, | 1387 | send_ack_to_client (ch, |
1358 | sender); | 1388 | to_owner); |
1359 | return GNUNET_OK; | 1389 | return GNUNET_OK; |
1360 | } | 1390 | } |
1361 | 1391 | ||
diff --git a/src/cadet/gnunet-service-cadet-new_channel.h b/src/cadet/gnunet-service-cadet-new_channel.h index 99124f651..d1b854570 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.h +++ b/src/cadet/gnunet-service-cadet-new_channel.h | |||
@@ -220,7 +220,7 @@ GCCH_handle_remote_destroy (struct CadetChannel *ch); | |||
220 | * buffer space in the tunnel. | 220 | * buffer space in the tunnel. |
221 | * | 221 | * |
222 | * @param ch Channel. | 222 | * @param ch Channel. |
223 | * @param sender client sending the data | 223 | * @param sender_ccn ccn of the sender |
224 | * @param buf payload to transmit. | 224 | * @param buf payload to transmit. |
225 | * @param buf_len number of bytes in @a buf | 225 | * @param buf_len number of bytes in @a buf |
226 | * @return #GNUNET_OK if everything goes well, | 226 | * @return #GNUNET_OK if everything goes well, |
@@ -228,7 +228,7 @@ GCCH_handle_remote_destroy (struct CadetChannel *ch); | |||
228 | */ | 228 | */ |
229 | int | 229 | int |
230 | GCCH_handle_local_data (struct CadetChannel *ch, | 230 | GCCH_handle_local_data (struct CadetChannel *ch, |
231 | struct CadetClient *sender, | 231 | struct GNUNET_CADET_ClientChannelNumber sender_ccn, |
232 | const char *buf, | 232 | const char *buf, |
233 | size_t buf_len); | 233 | size_t buf_len); |
234 | 234 | ||
diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c b/src/cadet/gnunet-service-cadet-new_tunnels.c index 8418dc50d..c6a8b8962 100644 --- a/src/cadet/gnunet-service-cadet-new_tunnels.c +++ b/src/cadet/gnunet-service-cadet-new_tunnels.c | |||
@@ -2154,7 +2154,7 @@ handle_plaintext_channel_open_ack (void *cls, | |||
2154 | return; | 2154 | return; |
2155 | } | 2155 | } |
2156 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2156 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2157 | "Receicved channel OPEN_ACK on channel %s from %s\n", | 2157 | "Received channel OPEN_ACK on channel %s from %s\n", |
2158 | GCCH_2s (ch), | 2158 | GCCH_2s (ch), |
2159 | GCT_2s (t)); | 2159 | GCT_2s (t)); |
2160 | GCCH_handle_channel_open_ack (ch); | 2160 | GCCH_handle_channel_open_ack (ch); |