aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh_new.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-07-11 11:33:54 +0000
committerBart Polot <bart@net.in.tum.de>2012-07-11 11:33:54 +0000
commit29e7ab6dc92905c2bfdcd009f19ac79bea45f965 (patch)
tree061e10cf831812addd905f3835731576b4de7be0 /src/mesh/gnunet-service-mesh_new.c
parent7c9d1eb1221cd43b5141f6d2e4b192d645e96125 (diff)
downloadgnunet-29e7ab6dc92905c2bfdcd009f19ac79bea45f965.tar.gz
gnunet-29e7ab6dc92905c2bfdcd009f19ac79bea45f965.zip
- cancel search only after successful connect/ack
Diffstat (limited to 'src/mesh/gnunet-service-mesh_new.c')
-rw-r--r--src/mesh/gnunet-service-mesh_new.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/mesh/gnunet-service-mesh_new.c b/src/mesh/gnunet-service-mesh_new.c
index c087fdd96..a46d56fb5 100644
--- a/src/mesh/gnunet-service-mesh_new.c
+++ b/src/mesh/gnunet-service-mesh_new.c
@@ -407,12 +407,17 @@ struct MeshTunnel
407 * Used to search peers offering a service 407 * Used to search peers offering a service
408 */ 408 */
409 struct GNUNET_DHT_GetHandle *dht_get_type; 409 struct GNUNET_DHT_GetHandle *dht_get_type;
410 410
411 /** 411 /**
412 * Context of the regex search for a connect_by_string 412 * Initial context of the regex search for a connect_by_string
413 */ 413 */
414 struct MeshRegexSearchContext *regex_ctx; 414 struct MeshRegexSearchContext *regex_ctx;
415 415
416 /**
417 * Peer that is connecting via connect_by_string. When connected, free ctx.
418 */
419 GNUNET_PEER_Id regex_peer;
420
416 /** 421 /**
417 * Task to keep the used paths alive 422 * Task to keep the used paths alive
418 */ 423 */
@@ -3846,6 +3851,15 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
3846 } 3851 }
3847 3852
3848 peer_info = peer_info_get (&msg->peer_id); 3853 peer_info = peer_info_get (&msg->peer_id);
3854
3855 if (t->regex_peer == peer_info->id && NULL != t->regex_ctx)
3856 {
3857 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3858 "connect_by_string completed, stopping search\n");
3859 regex_cancel_search (t->regex_ctx);
3860 t->regex_ctx = NULL;
3861 t->regex_peer = 0;
3862 }
3849 3863
3850 /* Add paths to peers? */ 3864 /* Add paths to peers? */
3851 p = tree_get_path_to_peer (t->tree, peer_info->id); 3865 p = tree_get_path_to_peer (t->tree, peer_info->id);
@@ -4315,9 +4329,7 @@ dht_get_string_accept_handler (void *cls, struct GNUNET_TIME_Absolute exp,
4315 4329
4316 tunnel_add_peer (info->t, peer_info); 4330 tunnel_add_peer (info->t, peer_info);
4317 peer_info_connect (peer_info, info->t); 4331 peer_info_connect (peer_info, info->t);
4318 4332 info->t->regex_peer = peer_info->id;
4319 // FIXME REGEX cancel only AFTER successful connection (received ACK)
4320 regex_cancel_search (ctx);
4321 4333
4322 return; 4334 return;
4323} 4335}