gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r31403 - gnunet/src/mesh
Date: Mon, 16 Dec 2013 12:55:37 +0100

Author: bartpolot
Date: 2013-12-16 12:55:37 +0100 (Mon, 16 Dec 2013)
New Revision: 31403

Modified:
   gnunet/src/mesh/gnunet-service-mesh_connection.c
   gnunet/src/mesh/gnunet-service-mesh_peer.c
   gnunet/src/mesh/gnunet-service-mesh_peer.h
   gnunet/src/mesh/gnunet-service-mesh_tunnel.c
   gnunet/src/mesh/gnunet-service-mesh_tunnel.h
Log:
- don't loop on the same invalid path


Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-12-16 11:38:09 UTC 
(rev 31402)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-12-16 11:55:37 UTC 
(rev 31403)
@@ -179,7 +179,8 @@
   enum MeshConnectionState state;
 
   /**
-   * Path being used for the tunnel.
+   * Path being used for the tunnel. At the origin of the connection
+   * it's a pointer to the destination's path pool, otherwise just a copy.
    */
   struct MeshPeerPath *path;
 
@@ -1149,7 +1150,7 @@
       || GNUNET_NO == GMP_is_neighbor (prev_peer))
   {
     if (GMC_is_origin (c, GNUNET_YES))
-      GNUNET_STATISTICS_update (stats, "# local bad paths", 1, GNUNET_NO);
+    GNUNET_STATISTICS_update (stats, "# local bad paths", 1, GNUNET_NO);
     GNUNET_STATISTICS_update (stats, "# bad paths", 1, GNUNET_NO);
 
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  register neighbors failed\n");
@@ -2220,6 +2221,11 @@
 
   if (GNUNET_OK != register_neighbors (c))
   {
+    if (0 == own_pos)
+    {
+      GMT_remove_path (c->t, p);
+      path_destroy (p);
+    }
     GMC_destroy (c);
     return NULL;
   }

Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c  2013-12-16 11:38:09 UTC (rev 
31402)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c  2013-12-16 11:55:37 UTC (rev 
31403)
@@ -1595,6 +1595,32 @@
 
 
 /**
+ * Remove any path to the peer that has the extact same peers as the one given.
+ *
+ * @param peer Peer to remove the path from.
+ * @param path Path to remove.
+ */
+void
+GMP_remove_path (struct MeshPeer *peer, struct MeshPeerPath *path)
+{
+  struct MeshPeerPath *iter;
+  struct MeshPeerPath *next;
+
+  GNUNET_assert (myid == path->peers[path->length - 1]);
+
+  for (iter = peer->path_head; NULL != iter; iter = next)
+  {
+    next = iter->next;
+    if (0 == memcmp (path->peers, iter->peers,
+                     sizeof (GNUNET_PEER_Id) * path->length))
+    {
+      path_destroy (iter);
+    }
+  }
+}
+
+
+/**
  * Remove a connection from a neighboring peer.
  *
  * @param peer Peer to remove connection from.

Modified: gnunet/src/mesh/gnunet-service-mesh_peer.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.h  2013-12-16 11:38:09 UTC (rev 
31402)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.h  2013-12-16 11:55:37 UTC (rev 
31403)
@@ -251,6 +251,15 @@
 GMP_add_path_to_all (const struct MeshPeerPath *p, int confirmed);
 
 /**
+ * Remove any path to the peer that has the extact same peers as the one given.
+ *
+ * @param peer Peer to remove the path from.
+ * @param path Path to remove.
+ */
+void
+GMP_remove_path (struct MeshPeer *peer, struct MeshPeerPath *path);
+
+/**
  * Remove a connection from a neighboring peer.
  *
  * @param peer Peer to remove connection from.

Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-12-16 11:38:09 UTC 
(rev 31402)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-12-16 11:55:37 UTC 
(rev 31403)
@@ -1756,6 +1756,19 @@
 
 
 /**
+ * Mark a path as no longer valid for this tunnel: has been tried and failed.
+ *
+ * @param t Tunnel to update.
+ * @param path Invalid path.
+ */
+void
+GMT_remove_path (struct MeshTunnel3 *t, struct MeshPeerPath *path)
+{
+  GMP_remove_path (t->peer, path);
+}
+
+
+/**
  * Remove a connection from a tunnel.
  *
  * @param t Tunnel.

Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.h        2013-12-16 11:38:09 UTC 
(rev 31402)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.h        2013-12-16 11:55:37 UTC 
(rev 31403)
@@ -214,6 +214,15 @@
 GMT_add_connection (struct MeshTunnel3 *t, struct MeshConnection *c);
 
 /**
+ * Mark a path as no longer valid for this tunnel: has been tried and failed.
+ *
+ * @param t Tunnel to update.
+ * @param path Invalid path.
+ */
+void
+GMT_remove_path (struct MeshTunnel3 *t, struct MeshPeerPath *path);
+
+/**
  * Remove a connection from a tunnel.
  *
  * @param t Tunnel.




reply via email to

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