gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r28925 - gnunet/src/mesh
Date: Fri, 30 Aug 2013 19:18:47 +0200

Author: bartpolot
Date: 2013-08-30 19:18:47 +0200 (Fri, 30 Aug 2013)
New Revision: 28925

Modified:
   gnunet/src/mesh/gnunet-service-mesh-enc.c
Log:
- sync


Modified: gnunet/src/mesh/gnunet-service-mesh-enc.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh-enc.c   2013-08-30 16:34:13 UTC (rev 
28924)
+++ gnunet/src/mesh/gnunet-service-mesh-enc.c   2013-08-30 17:18:47 UTC (rev 
28925)
@@ -2464,11 +2464,15 @@
   struct MeshTunnel2 *t;
   struct MeshPeerPath *p;
   struct MeshConnection *c;
+  int rerun_dhtget;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "peer_connect towards %s\n",
               peer2s (peer));
   t = peer->tunnel;
+  c = NULL;
+  rerun_dhtget = GNUNET_NO;
+
   if (NULL != peer->path_head)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "path exists\n");
@@ -2488,15 +2492,30 @@
          * In this case, the peer->connections hashmap will be NULL and
          * tunnel_use_path will not be able to create a connection from that
          * path.
+         *
+         * Re-running the DHT GET should give core time to callback.
          */
         GNUNET_break(0);
+        rerun_dhtget = GNUNET_YES;
+      }
+      else
+      {
+        send_connection_create (c);
         return;
       }
-      send_connection_create (c);
     }
   }
-  else if (NULL == peer->dhtget)
+
+  if (NULL != peer->dhtget && GNUNET_YES == rerun_dhtget)
   {
+    GNUNET_DHT_get_stop (peer->dhtget);
+    peer->dhtget = NULL;
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "  Stopping DHT GET for peer %s\n", peer2s (peer));
+  }
+
+  if (NULL == peer->dhtget)
+  {
     const struct GNUNET_PeerIdentity *id;
 
     id = GNUNET_PEER_resolve2 (peer->id);
@@ -2514,11 +2533,6 @@
     if (MESH_TUNNEL_NEW == t->state)
       tunnel_change_state (t, MESH_TUNNEL_SEARCHING);
   }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "There is no path but the DHT GET is already started.\n");
-  }
 }
 
 
@@ -2680,8 +2694,8 @@
  * @param p1 GNUNET_PEER_Id of one peer.
  * @param p2 GNUNET_PEER_Id of another peer that was connected to the first and
  *           no longer is.
- *
- * TODO: optimize (see below)
+ * 
+ * FIXME use peer->connections!!!
  */
 static void
 peer_remove_path (struct MeshPeer *peer, GNUNET_PEER_Id p1,
@@ -2714,7 +2728,6 @@
   if (0 == destroyed)
     return;
 
-
   d = tunnel_notify_connection_broken (peer->tunnel, p1, p2);
 
   peer_d = peer_get_short (d); // FIXME
@@ -5432,7 +5445,10 @@
     peer_add_path_to_origin (orig_peer, path, GNUNET_YES);
 
     if (NULL == orig_peer->tunnel)
+    {
       orig_peer->tunnel = tunnel_new ();
+      orig_peer->tunnel->peer = orig_peer;
+    }
     tunnel_add_connection (orig_peer->tunnel, c);
 
     send_connection_ack (c, GNUNET_NO);




reply via email to

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