gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r22600 - gnunet/src/mesh
Date: Wed, 11 Jul 2012 13:33:54 +0200

Author: bartpolot
Date: 2012-07-11 13:33:54 +0200 (Wed, 11 Jul 2012)
New Revision: 22600

Modified:
   gnunet/src/mesh/gnunet-service-mesh_new.c
Log:
- cancel search only after successful connect/ack

Modified: gnunet/src/mesh/gnunet-service-mesh_new.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_new.c   2012-07-11 09:16:58 UTC (rev 
22599)
+++ gnunet/src/mesh/gnunet-service-mesh_new.c   2012-07-11 11:33:54 UTC (rev 
22600)
@@ -407,12 +407,17 @@
      * Used to search peers offering a service
      */
   struct GNUNET_DHT_GetHandle *dht_get_type;
-  
+
     /**
-     * Context of the regex search for a connect_by_string
+     * Initial context of the regex search for a connect_by_string
      */
   struct MeshRegexSearchContext *regex_ctx;
 
+    /**
+     * Peer that is connecting via connect_by_string. When connected, free ctx.
+     */
+  GNUNET_PEER_Id regex_peer;
+
   /**
    * Task to keep the used paths alive
    */
@@ -3846,6 +3851,15 @@
   }
 
   peer_info = peer_info_get (&msg->peer_id);
+  
+  if (t->regex_peer == peer_info->id && NULL != t->regex_ctx)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "connect_by_string completed, stopping search\n");
+    regex_cancel_search (t->regex_ctx);
+    t->regex_ctx = NULL;
+    t->regex_peer = 0;
+  }
 
   /* Add paths to peers? */
   p = tree_get_path_to_peer (t->tree, peer_info->id);
@@ -4315,10 +4329,8 @@
 
   tunnel_add_peer (info->t, peer_info);
   peer_info_connect (peer_info, info->t);
+  info->t->regex_peer = peer_info->id;
 
-  // FIXME REGEX cancel only AFTER successful connection (received ACK)
-  regex_cancel_search (ctx);
-
   return;
 }
 




reply via email to

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