projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- add separate encryption enabled mesh to avoid breakage during developement
[oweals/gnunet.git]
/
src
/
mesh
/
mesh_tunnel_tree.c
diff --git
a/src/mesh/mesh_tunnel_tree.c
b/src/mesh/mesh_tunnel_tree.c
index f18f14da5a261dc629676b64e3264b1fceee90f0..c2fe6c3d98776e90c4527d0882f42dd0d6228580 100644
(file)
--- a/
src/mesh/mesh_tunnel_tree.c
+++ b/
src/mesh/mesh_tunnel_tree.c
@@
-379,6
+379,8
@@
tree_node_destroy (struct MeshTunnelTreeNode *parent)
struct MeshTunnelTreeNode *n;
struct MeshTunnelTreeNode *next;
struct MeshTunnelTreeNode *n;
struct MeshTunnelTreeNode *next;
+ if (NULL == parent)
+ return;
#if MESH_TREE_DEBUG
struct GNUNET_PeerIdentity id;
#if MESH_TREE_DEBUG
struct GNUNET_PeerIdentity id;
@@
-494,7
+496,7
@@
tree_get_predecessor (struct MeshTunnelTree *tree)
*
* @return peerinfo of the peer who is the first hop in the tunnel
* NULL on error
*
* @return peerinfo of the peer who is the first hop in the tunnel
* NULL on error
- *
+ *
* FIXME use PEER_Id
*/
struct GNUNET_PeerIdentity *
* FIXME use PEER_Id
*/
struct GNUNET_PeerIdentity *
@@
-594,10
+596,7
@@
tree_iterate_children (struct MeshTunnelTree *tree, MeshTreeCallback cb,
struct MeshTunnelTreeNode *n;
if (NULL == tree->me)
struct MeshTunnelTreeNode *n;
if (NULL == tree->me)
- {
- GNUNET_break (0);
return;
return;
- }
for (n = tree->me->children_head; NULL != n; n = n->next)
{
cb (cb_cls, n->peer);
for (n = tree->me->children_head; NULL != n; n = n->next)
{
cb (cb_cls, n->peer);
@@
-743,7
+742,7
@@
tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Deleting path to %s.\n",
GNUNET_i2s (&id));
#endif
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)
return NULL;
for (n = t->disconnected_head; NULL != n; n = n->next)
@@
-766,8
+765,7
@@
tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id,
n->parent = NULL;
while (MESH_PEER_RELAY == parent->status &&
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);
{
#if MESH_TREE_DEBUG
GNUNET_PEER_resolve (parent->peer, &id);
@@
-775,6
+773,8
@@
tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id,
GNUNET_i2s (&id));
#endif
n = parent->parent;
GNUNET_i2s (&id));
#endif
n = parent->parent;
+ if (parent == t->me)
+ t->me = NULL;
tree_node_destroy (parent);
parent = n;
}
tree_node_destroy (parent);
parent = n;
}
@@
-1068,7
+1068,6
@@
tree_del_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer,
GNUNET_break (0);
return GNUNET_YES;
}
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_node_destroy (n);
if (NULL == t->root->children_head && t->me != t->root)
{
@@
-1135,6
+1134,8
@@
void
tree_debug (struct MeshTunnelTree *t)
{
tree_node_debug (t->root, 0);
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);
}
}