diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-10-11 17:22:27 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-10-11 17:22:27 +0000 |
commit | ac4befb8c44d653f60924a088f5c6ffd671e13f6 (patch) | |
tree | b0447adbee9978ee7f30a5faeb3ac775e9a2f9f4 /src/mesh/mesh_tunnel_tree.c | |
parent | 06ca63e03b0d8fd77673b3e759aab65dc5e0f3da (diff) | |
download | gnunet-ac4befb8c44d653f60924a088f5c6ffd671e13f6.tar.gz gnunet-ac4befb8c44d653f60924a088f5c6ffd671e13f6.zip |
Fixes in path creation
Diffstat (limited to 'src/mesh/mesh_tunnel_tree.c')
-rw-r--r-- | src/mesh/mesh_tunnel_tree.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/mesh/mesh_tunnel_tree.c b/src/mesh/mesh_tunnel_tree.c index cea028670..7ad5bfbd7 100644 --- a/src/mesh/mesh_tunnel_tree.c +++ b/src/mesh/mesh_tunnel_tree.c | |||
@@ -313,7 +313,7 @@ tree_mark_peers_disconnected (struct MeshTunnelTree *tree, | |||
313 | { | 313 | { |
314 | tree_mark_peers_disconnected (tree, n, cb); | 314 | tree_mark_peers_disconnected (tree, n, cb); |
315 | } | 315 | } |
316 | if (MESH_PEER_READY == parent->status) | 316 | if (MESH_PEER_READY == parent->status && NULL != cb) |
317 | { | 317 | { |
318 | cb (parent); | 318 | cb (parent); |
319 | } | 319 | } |
@@ -420,7 +420,7 @@ tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id, | |||
420 | return n; | 420 | return n; |
421 | } | 421 | } |
422 | } | 422 | } |
423 | n = tree_find_peer (t->me, peer_id); | 423 | n = tree_find_peer (t->root, peer_id); |
424 | if (NULL == n) | 424 | if (NULL == n) |
425 | return NULL; | 425 | return NULL; |
426 | node = n; | 426 | node = n; |
@@ -522,12 +522,14 @@ tree_add_path (struct MeshTunnelTree *t, | |||
522 | unsigned int i; | 522 | unsigned int i; |
523 | 523 | ||
524 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 524 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
525 | "tree: Adding path [%u] towards peer %u to peer %u.\n", | 525 | "tree: Adding path [%u] towards peer %u.\n", |
526 | p->length, | 526 | p->length, |
527 | p->peers[p->length - 1], | 527 | p->peers[p->length - 1]); |
528 | t->me->peer); | ||
529 | 528 | ||
530 | myid = t->me->peer; | 529 | if (NULL != t->me) |
530 | myid = t->me->peer; | ||
531 | else | ||
532 | myid = 0; | ||
531 | GNUNET_assert(0 != p->length); | 533 | GNUNET_assert(0 != p->length); |
532 | parent = n = t->root; | 534 | parent = n = t->root; |
533 | if (n->peer != p->peers[0]) | 535 | if (n->peer != p->peers[0]) |
@@ -571,12 +573,6 @@ tree_add_path (struct MeshTunnelTree *t, | |||
571 | } | 573 | } |
572 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 574 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
573 | "tree: All childen visited.\n"); | 575 | "tree: All childen visited.\n"); |
574 | if (-1 == me) | ||
575 | { | ||
576 | /* New path deviates from tree before reaching us. What happened? */ | ||
577 | GNUNET_break (0); | ||
578 | return GNUNET_SYSERR; | ||
579 | } | ||
580 | /* Add the rest of the path as a branch from parent. */ | 576 | /* Add the rest of the path as a branch from parent. */ |
581 | while (i < p->length) | 577 | while (i < p->length) |
582 | { | 578 | { |