struct MeshTunnelTreeNode *n;
struct MeshTunnelTreeNode *next;
+ if (NULL == parent)
+ return;
#if MESH_TREE_DEBUG
struct GNUNET_PeerIdentity id;
*
* @return peerinfo of the peer who is the first hop in the tunnel
* NULL on error
- *
+ *
* FIXME use PEER_Id
*/
struct GNUNET_PeerIdentity *
struct MeshTunnelTreeNode *n;
if (NULL == tree->me)
- {
- GNUNET_break (0);
return;
- }
for (n = tree->me->children_head; NULL != n; n = n->next)
{
cb (cb_cls, n->peer);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Deleting path to %s.\n",
GNUNET_i2s (&id));
#endif
- if (peer_id == t->root->peer)
+ if (NULL == t->root || peer_id == t->root->peer)
return NULL;
for (n = t->disconnected_head; NULL != n; n = n->next)
n->parent = NULL;
while (MESH_PEER_RELAY == parent->status &&
- NULL == parent->children_head &&
- parent->peer != t->me->peer)
+ NULL == parent->children_head)
{
#if MESH_TREE_DEBUG
GNUNET_PEER_resolve (parent->peer, &id);
GNUNET_i2s (&id));
#endif
n = parent->parent;
+ if (parent == t->me)
+ t->me = NULL;
tree_node_destroy (parent);
parent = n;
}
GNUNET_break (0);
return GNUNET_YES;
}
- GNUNET_break (NULL == n->children_head);
tree_node_destroy (n);
if (NULL == t->root->children_head && t->me != t->root)
{
tree_debug (struct MeshTunnelTree *t)
{
tree_node_debug (t->root, 0);
+ FPRINTF (stderr, "root: %p\n", t->root);
+ FPRINTF (stderr, "me: %p\n", t->me);
}