aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-10-11 14:47:29 +0000
committerBart Polot <bart@net.in.tum.de>2013-10-11 14:47:29 +0000
commit08d6c382e9224d1ef91f8fda4030e8665b41d5d6 (patch)
tree05d38055606e90f7f04797fa51e72d9a4ccfa6dd /src/mesh
parent303053f66bbfb4aff2f4c7514fe0dc2e30d5415c (diff)
downloadgnunet-08d6c382e9224d1ef91f8fda4030e8665b41d5d6.tar.gz
gnunet-08d6c382e9224d1ef91f8fda4030e8665b41d5d6.zip
- fix channel data/ack
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/gnunet-service-mesh_channel.c55
1 files changed, 32 insertions, 23 deletions
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c
index d0c39edfb..8b90938b1 100644
--- a/src/mesh/gnunet-service-mesh_channel.c
+++ b/src/mesh/gnunet-service-mesh_channel.c
@@ -599,6 +599,27 @@ rel_message_free (struct MeshReliableMessage *copy)
599} 599}
600 600
601 601
602/**
603 * Confirm we got a channel create.
604 *
605 * @param ch The channel to confirm.
606 * @param fwd Should we send the ACK fwd?
607 */
608static void
609channel_send_ack (struct MeshChannel *ch, int fwd)
610{
611 struct GNUNET_MESH_ChannelManage msg;
612
613 msg.header.size = htons (sizeof (msg));
614 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK);
615 LOG (GNUNET_ERROR_TYPE_DEBUG,
616 " sending channel %s ack for channel %s\n",
617 fwd ? "FWD" : "BCK", GMCH_2s (ch));
618
619 msg.chid = htonl (ch->gid);
620 GMCH_send_prebuilt_message (&msg.header, ch, !fwd);
621}
622
602 623
603/** 624/**
604 * Channel was ACK'd by remote peer, mark as ready and cancel retransmission. 625 * Channel was ACK'd by remote peer, mark as ready and cancel retransmission.
@@ -631,7 +652,7 @@ channel_confirm (struct MeshChannel *ch, int fwd)
631 /* TODO return? */ 652 /* TODO return? */
632 } 653 }
633 } 654 }
634 GMC_send_ack (NULL, ch, fwd); 655 channel_send_ack (ch, fwd);
635} 656}
636 657
637 658
@@ -829,28 +850,6 @@ channel_set_options (struct MeshChannel *ch, uint32_t options)
829 850
830 851
831/** 852/**
832 * Confirm we got a channel create.
833 *
834 * @param ch The channel to confirm.
835 * @param fwd Should we send the ACK fwd?
836 */
837static void
838channel_send_ack (struct MeshChannel *ch, int fwd)
839{
840 struct GNUNET_MESH_ChannelManage msg;
841
842 msg.header.size = htons (sizeof (msg));
843 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK);
844 LOG (GNUNET_ERROR_TYPE_DEBUG,
845 " sending channel %s ack for channel %s\n",
846 fwd ? "FWD" : "BCK", GMCH_2s (ch));
847
848 msg.chid = htonl (ch->gid);
849 GMCH_send_prebuilt_message (&msg.header, ch, !fwd);
850}
851
852
853/**
854 * Handle a loopback message: call the appropriate handler for the message type. 853 * Handle a loopback message: call the appropriate handler for the message type.
855 * 854 *
856 * @param ch Channel this message is on. 855 * @param ch Channel this message is on.
@@ -1055,6 +1054,16 @@ GMCH_send_data (struct MeshChannel *ch,
1055 const struct GNUNET_MESH_Data *msg, 1054 const struct GNUNET_MESH_Data *msg,
1056 int fwd) 1055 int fwd)
1057{ 1056{
1057 if (GMCH_is_terminal (ch, fwd))
1058 {
1059 GML_send_data (fwd ? ch->dest : ch->root,
1060 msg,
1061 fwd ? ch->lid_dest : ch->lid_root);
1062 }
1063 else
1064 {
1065 GMT_send_prebuilt_message (&msg->header, ch->t, ch, fwd);
1066 }
1058} 1067}
1059 1068
1060 1069