diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-12-21 01:37:02 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-12-21 01:37:02 +0000 |
commit | cc53b95ac7cb62b00193c6b13522d9f25d02aa2f (patch) | |
tree | 414c83e6f2b4f25baac5694775d316475e876357 /src/mesh | |
parent | 9a4e37f4af4eb47313d62ff1c6d6a0f5b42c82ed (diff) | |
download | gnunet-cc53b95ac7cb62b00193c6b13522d9f25d02aa2f.tar.gz gnunet-cc53b95ac7cb62b00193c6b13522d9f25d02aa2f.zip |
- revert 25599, fix tree destruction segfault
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/mesh_tunnel_tree.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mesh/mesh_tunnel_tree.c b/src/mesh/mesh_tunnel_tree.c index f18f14da5..586654a2d 100644 --- a/src/mesh/mesh_tunnel_tree.c +++ b/src/mesh/mesh_tunnel_tree.c | |||
@@ -379,6 +379,8 @@ tree_node_destroy (struct MeshTunnelTreeNode *parent) | |||
379 | struct MeshTunnelTreeNode *n; | 379 | struct MeshTunnelTreeNode *n; |
380 | struct MeshTunnelTreeNode *next; | 380 | struct MeshTunnelTreeNode *next; |
381 | 381 | ||
382 | if (NULL == parent) | ||
383 | return; | ||
382 | #if MESH_TREE_DEBUG | 384 | #if MESH_TREE_DEBUG |
383 | struct GNUNET_PeerIdentity id; | 385 | struct GNUNET_PeerIdentity id; |
384 | 386 | ||
@@ -594,10 +596,7 @@ tree_iterate_children (struct MeshTunnelTree *tree, MeshTreeCallback cb, | |||
594 | struct MeshTunnelTreeNode *n; | 596 | struct MeshTunnelTreeNode *n; |
595 | 597 | ||
596 | if (NULL == tree->me) | 598 | if (NULL == tree->me) |
597 | { | ||
598 | GNUNET_break (0); | ||
599 | return; | 599 | return; |
600 | } | ||
601 | for (n = tree->me->children_head; NULL != n; n = n->next) | 600 | for (n = tree->me->children_head; NULL != n; n = n->next) |
602 | { | 601 | { |
603 | cb (cb_cls, n->peer); | 602 | cb (cb_cls, n->peer); |
@@ -766,8 +765,7 @@ tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id, | |||
766 | n->parent = NULL; | 765 | n->parent = NULL; |
767 | 766 | ||
768 | while (MESH_PEER_RELAY == parent->status && | 767 | while (MESH_PEER_RELAY == parent->status && |
769 | NULL == parent->children_head && | 768 | NULL == parent->children_head) |
770 | parent->peer != t->me->peer) | ||
771 | { | 769 | { |
772 | #if MESH_TREE_DEBUG | 770 | #if MESH_TREE_DEBUG |
773 | GNUNET_PEER_resolve (parent->peer, &id); | 771 | GNUNET_PEER_resolve (parent->peer, &id); |
@@ -775,6 +773,8 @@ tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id, | |||
775 | GNUNET_i2s (&id)); | 773 | GNUNET_i2s (&id)); |
776 | #endif | 774 | #endif |
777 | n = parent->parent; | 775 | n = parent->parent; |
776 | if (parent == t->me) | ||
777 | t->me = NULL; | ||
778 | tree_node_destroy (parent); | 778 | tree_node_destroy (parent); |
779 | parent = n; | 779 | parent = n; |
780 | } | 780 | } |
@@ -1135,6 +1135,8 @@ void | |||
1135 | tree_debug (struct MeshTunnelTree *t) | 1135 | tree_debug (struct MeshTunnelTree *t) |
1136 | { | 1136 | { |
1137 | tree_node_debug (t->root, 0); | 1137 | tree_node_debug (t->root, 0); |
1138 | FPRINTF (stderr, "root: %p\n", t->root); | ||
1139 | FPRINTF (stderr, "me: %p\n", t->me); | ||
1138 | } | 1140 | } |
1139 | 1141 | ||
1140 | 1142 | ||