diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-08-30 17:18:47 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-08-30 17:18:47 +0000 |
commit | e5eb7662ac5c7ebc2853ec302caef43874714acf (patch) | |
tree | 3ad87aa111f7b60a08a1efe06cefc2b2ca5b501b /src/mesh | |
parent | 40290626360c4bc79affb6490b893ec4c2ba9da2 (diff) | |
download | gnunet-e5eb7662ac5c7ebc2853ec302caef43874714acf.tar.gz gnunet-e5eb7662ac5c7ebc2853ec302caef43874714acf.zip |
- sync
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/gnunet-service-mesh-enc.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/mesh/gnunet-service-mesh-enc.c b/src/mesh/gnunet-service-mesh-enc.c index 8a0139176..c6bbe6a48 100644 --- a/src/mesh/gnunet-service-mesh-enc.c +++ b/src/mesh/gnunet-service-mesh-enc.c | |||
@@ -2464,11 +2464,15 @@ peer_connect (struct MeshPeer *peer) | |||
2464 | struct MeshTunnel2 *t; | 2464 | struct MeshTunnel2 *t; |
2465 | struct MeshPeerPath *p; | 2465 | struct MeshPeerPath *p; |
2466 | struct MeshConnection *c; | 2466 | struct MeshConnection *c; |
2467 | int rerun_dhtget; | ||
2467 | 2468 | ||
2468 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2469 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2469 | "peer_connect towards %s\n", | 2470 | "peer_connect towards %s\n", |
2470 | peer2s (peer)); | 2471 | peer2s (peer)); |
2471 | t = peer->tunnel; | 2472 | t = peer->tunnel; |
2473 | c = NULL; | ||
2474 | rerun_dhtget = GNUNET_NO; | ||
2475 | |||
2472 | if (NULL != peer->path_head) | 2476 | if (NULL != peer->path_head) |
2473 | { | 2477 | { |
2474 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "path exists\n"); | 2478 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "path exists\n"); |
@@ -2488,14 +2492,29 @@ peer_connect (struct MeshPeer *peer) | |||
2488 | * In this case, the peer->connections hashmap will be NULL and | 2492 | * In this case, the peer->connections hashmap will be NULL and |
2489 | * tunnel_use_path will not be able to create a connection from that | 2493 | * tunnel_use_path will not be able to create a connection from that |
2490 | * path. | 2494 | * path. |
2495 | * | ||
2496 | * Re-running the DHT GET should give core time to callback. | ||
2491 | */ | 2497 | */ |
2492 | GNUNET_break(0); | 2498 | GNUNET_break(0); |
2499 | rerun_dhtget = GNUNET_YES; | ||
2500 | } | ||
2501 | else | ||
2502 | { | ||
2503 | send_connection_create (c); | ||
2493 | return; | 2504 | return; |
2494 | } | 2505 | } |
2495 | send_connection_create (c); | ||
2496 | } | 2506 | } |
2497 | } | 2507 | } |
2498 | else if (NULL == peer->dhtget) | 2508 | |
2509 | if (NULL != peer->dhtget && GNUNET_YES == rerun_dhtget) | ||
2510 | { | ||
2511 | GNUNET_DHT_get_stop (peer->dhtget); | ||
2512 | peer->dhtget = NULL; | ||
2513 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2514 | " Stopping DHT GET for peer %s\n", peer2s (peer)); | ||
2515 | } | ||
2516 | |||
2517 | if (NULL == peer->dhtget) | ||
2499 | { | 2518 | { |
2500 | const struct GNUNET_PeerIdentity *id; | 2519 | const struct GNUNET_PeerIdentity *id; |
2501 | 2520 | ||
@@ -2514,11 +2533,6 @@ peer_connect (struct MeshPeer *peer) | |||
2514 | if (MESH_TUNNEL_NEW == t->state) | 2533 | if (MESH_TUNNEL_NEW == t->state) |
2515 | tunnel_change_state (t, MESH_TUNNEL_SEARCHING); | 2534 | tunnel_change_state (t, MESH_TUNNEL_SEARCHING); |
2516 | } | 2535 | } |
2517 | else | ||
2518 | { | ||
2519 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2520 | "There is no path but the DHT GET is already started.\n"); | ||
2521 | } | ||
2522 | } | 2536 | } |
2523 | 2537 | ||
2524 | 2538 | ||
@@ -2680,8 +2694,8 @@ connection_cancel_queues (struct MeshConnection *c, int fwd) | |||
2680 | * @param p1 GNUNET_PEER_Id of one peer. | 2694 | * @param p1 GNUNET_PEER_Id of one peer. |
2681 | * @param p2 GNUNET_PEER_Id of another peer that was connected to the first and | 2695 | * @param p2 GNUNET_PEER_Id of another peer that was connected to the first and |
2682 | * no longer is. | 2696 | * no longer is. |
2683 | * | 2697 | * |
2684 | * TODO: optimize (see below) | 2698 | * FIXME use peer->connections!!! |
2685 | */ | 2699 | */ |
2686 | static void | 2700 | static void |
2687 | peer_remove_path (struct MeshPeer *peer, GNUNET_PEER_Id p1, | 2701 | peer_remove_path (struct MeshPeer *peer, GNUNET_PEER_Id p1, |
@@ -2714,7 +2728,6 @@ peer_remove_path (struct MeshPeer *peer, GNUNET_PEER_Id p1, | |||
2714 | if (0 == destroyed) | 2728 | if (0 == destroyed) |
2715 | return; | 2729 | return; |
2716 | 2730 | ||
2717 | |||
2718 | d = tunnel_notify_connection_broken (peer->tunnel, p1, p2); | 2731 | d = tunnel_notify_connection_broken (peer->tunnel, p1, p2); |
2719 | 2732 | ||
2720 | peer_d = peer_get_short (d); // FIXME | 2733 | peer_d = peer_get_short (d); // FIXME |
@@ -5432,7 +5445,10 @@ handle_mesh_connection_create (void *cls, | |||
5432 | peer_add_path_to_origin (orig_peer, path, GNUNET_YES); | 5445 | peer_add_path_to_origin (orig_peer, path, GNUNET_YES); |
5433 | 5446 | ||
5434 | if (NULL == orig_peer->tunnel) | 5447 | if (NULL == orig_peer->tunnel) |
5448 | { | ||
5435 | orig_peer->tunnel = tunnel_new (); | 5449 | orig_peer->tunnel = tunnel_new (); |
5450 | orig_peer->tunnel->peer = orig_peer; | ||
5451 | } | ||
5436 | tunnel_add_connection (orig_peer->tunnel, c); | 5452 | tunnel_add_connection (orig_peer->tunnel, c); |
5437 | 5453 | ||
5438 | send_connection_ack (c, GNUNET_NO); | 5454 | send_connection_ack (c, GNUNET_NO); |