gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r30150 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r30150 - gnunet/src/mesh
Date: Fri, 11 Oct 2013 16:47:29 +0200

Author: bartpolot
Date: 2013-10-11 16:47:29 +0200 (Fri, 11 Oct 2013)
New Revision: 30150

Modified:
   gnunet/src/mesh/gnunet-service-mesh_channel.c
Log:
- fix channel data/ack


Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-10-11 14:31:45 UTC 
(rev 30149)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-10-11 14:47:29 UTC 
(rev 30150)
@@ -599,7 +599,28 @@
 }
 
 
+/**
+ * Confirm we got a channel create.
+ *
+ * @param ch The channel to confirm.
+ * @param fwd Should we send the ACK fwd?
+ */
+static void
+channel_send_ack (struct MeshChannel *ch, int fwd)
+{
+  struct GNUNET_MESH_ChannelManage msg;
 
+  msg.header.size = htons (sizeof (msg));
+  msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+              "  sending channel %s ack for channel %s\n",
+              fwd ? "FWD" : "BCK", GMCH_2s (ch));
+
+  msg.chid = htonl (ch->gid);
+  GMCH_send_prebuilt_message (&msg.header, ch, !fwd);
+}
+
+
 /**
  * Channel was ACK'd by remote peer, mark as ready and cancel retransmission.
  *
@@ -631,7 +652,7 @@
       /* TODO return? */
     }
   }
-  GMC_send_ack (NULL, ch, fwd);
+  channel_send_ack (ch, fwd);
 }
 
 
@@ -829,28 +850,6 @@
 
 
 /**
- * Confirm we got a channel create.
- *
- * @param ch The channel to confirm.
- * @param fwd Should we send the ACK fwd?
- */
-static void
-channel_send_ack (struct MeshChannel *ch, int fwd)
-{
-  struct GNUNET_MESH_ChannelManage msg;
-
-  msg.header.size = htons (sizeof (msg));
-  msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-              "  sending channel %s ack for channel %s\n",
-              fwd ? "FWD" : "BCK", GMCH_2s (ch));
-
-  msg.chid = htonl (ch->gid);
-  GMCH_send_prebuilt_message (&msg.header, ch, !fwd);
-}
-
-
-/**
  * Handle a loopback message: call the appropriate handler for the message 
type.
  *
  * @param ch Channel this message is on.
@@ -1055,6 +1054,16 @@
                 const struct GNUNET_MESH_Data *msg,
                 int fwd)
 {
+  if (GMCH_is_terminal (ch, fwd))
+  {
+    GML_send_data (fwd ? ch->dest : ch->root,
+                   msg,
+                   fwd ? ch->lid_dest : ch->lid_root);
+  }
+  else
+  {
+    GMT_send_prebuilt_message (&msg->header, ch->t, ch, fwd);
+  }
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]