gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r22884 - gnunet/src/mesh
Date: Wed, 25 Jul 2012 03:15:11 +0200

Author: bartpolot
Date: 2012-07-25 03:15:11 +0200 (Wed, 25 Jul 2012)
New Revision: 22884

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
Log:
- add children info update on unicast

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2012-07-25 00:20:57 UTC (rev 
22883)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2012-07-25 01:15:11 UTC (rev 
22884)
@@ -3021,8 +3021,36 @@
 
 
 /**
- * Iterator to get the appropiate ACK value from all children nodes
+ * Increase the SKIP value of all peers that
+ * have not received a unicast message.
+ *
+ * @param cls Closure (Short id of the peer that HAS received the message).
+ * @param id Short ID of the neighbor.
  */
+static int
+tunnel_add_skip (void *cls,
+                 const struct GNUNET_HashCode * key,
+                 void *value)
+{
+  struct GNUNET_PeerIdentity *neighbor = cls;
+  struct MeshTunnelChildInfo *cinfo = value;
+
+  if (0 == memcmp (&neighbor->hashPubKey, key, sizeof (struct 
GNUNET_HashCode)))
+  {
+    return GNUNET_YES;
+  }
+  cinfo->skip++;
+  return GNUNET_YES;
+}
+
+
+
+/**
+ * Iterator to get the appropiate ACK value from all children nodes.
+ *
+ * @param cls Closue (tunnel).
+ * @param id Id of the child node.
+ */
 static void
 tunnel_get_child_ack (void *cls,
                       GNUNET_PEER_Id id)
@@ -4185,7 +4213,10 @@
                           unsigned int atsi_count)
 {
   struct GNUNET_MESH_Unicast *msg;
+  struct GNUNET_PeerIdentity *neighbor;
+  struct MeshTunnelChildInfo *cinfo;
   struct MeshTunnel *t;
+  GNUNET_PEER_Id dest_id;
   uint32_t pid;
   uint32_t ttl;
   size_t size;
@@ -4227,8 +4258,8 @@
   t->skip += (pid - t->pid) - 1;
   t->pid = pid;
   tunnel_reset_timeout (t);
-  pid = GNUNET_PEER_search (&msg->destination);
-  if (pid == myid)
+  dest_id = GNUNET_PEER_search (&msg->destination);
+  if (dest_id == myid)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "  it's for us! sending to clients...\n");
@@ -4249,7 +4280,27 @@
               "  not for us, retransmitting...\n");
   GNUNET_STATISTICS_update (stats, "# unicast forwarded", 1, GNUNET_NO);
 
-  send_message (message, tree_get_first_hop (t->tree, pid), t);
+  neighbor = tree_get_first_hop (t->tree, dest_id);
+  cinfo = GNUNET_CONTAINER_multihashmap_get (t->children_fc,
+                                             &neighbor->hashPubKey);
+  if (NULL == cinfo)
+  {
+    cinfo = GNUNET_malloc (sizeof (struct MeshTunnelChildInfo));
+    cinfo->id = GNUNET_PEER_intern (neighbor);
+    cinfo->skip = pid;
+    cinfo->max_pid = pid + t->queue_max - t->queue_n; // FIXME review
+
+    GNUNET_assert (GNUNET_OK ==
+                   GNUNET_CONTAINER_multihashmap_put (t->children_fc,
+                       &neighbor->hashPubKey,
+                       cinfo,
+                       GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
+  }
+  cinfo->pid = pid;
+  GNUNET_CONTAINER_multihashmap_iterate (t->children_fc,
+                                         &tunnel_add_skip,
+                                         &neighbor);
+  send_message (message, neighbor, t);
   return GNUNET_OK;
 }
 
@@ -6221,6 +6272,7 @@
   return;
 }
 
+
 /**
  * Functions to handle messages from clients
  */
@@ -6296,6 +6348,7 @@
   return;
 }
 
+
 /**
  * Method called whenever a given peer connects.
  *
@@ -6334,6 +6387,7 @@
   return;
 }
 
+
 /**
  * Method called whenever a peer disconnects.
  *




reply via email to

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