gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r30202 - gnunet/src/mesh
Date: Tue, 15 Oct 2013 16:20:46 +0200

Author: bartpolot
Date: 2013-10-15 16:20:46 +0200 (Tue, 15 Oct 2013)
New Revision: 30202

Modified:
   gnunet/src/mesh/gnunet-service-mesh_connection.c
   gnunet/src/mesh/gnunet-service-mesh_peer.c
Log:
- fix new connection handler


Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-10-15 14:08:29 UTC 
(rev 30201)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-10-15 14:20:46 UTC 
(rev 30202)
@@ -929,6 +929,23 @@
 }
 
 
+/**
+ * Bind the connection to the peer and the tunnel to that peer.
+ *
+ * If the peer has no tunnel, create one. Update tunnel and connection
+ * data structres to reflect new status.
+ *
+ * @param c Connection.
+ * @param peer Peer.
+ */
+static void
+add_to_peer (struct MeshConnection *c, struct MeshPeer *peer)
+{
+  GMP_add_tunnel (peer);
+  c->t = GMP_get_tunnel (peer);
+  GMT_add_connection (c->t, c);
+}
+
 
/******************************************************************************/
 /********************************    API    
***********************************/
 
/******************************************************************************/
@@ -1040,8 +1057,7 @@
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  It's for us!\n");
     GMP_add_path_to_origin (orig_peer, path, GNUNET_YES);
 
-    GMP_add_tunnel (orig_peer);
-    GMP_add_connection (orig_peer, c);
+    add_to_peer (c, orig_peer);
     if (MESH_TUNNEL3_NEW == GMT_get_state (c->t))
       GMT_change_state (c->t,  MESH_TUNNEL3_WAITING);
 

Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c  2013-10-15 14:08:29 UTC (rev 
30201)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c  2013-10-15 14:20:46 UTC (rev 
30202)
@@ -1390,6 +1390,7 @@
 
 /**
  * Create and initialize a new tunnel towards a peer, in case it has none.
+ * In case the peer already has a tunnel, nothing is done.
  *
  * Does not generate any traffic, just creates the local data structures.
  *




reply via email to

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