* Recusively update the info about what is the first hop to reach the node
*
* @param tree Tree this nodes belongs to.
- * @param parent_id Short ID from node form which to start updating.
+ * @param parent ID from node form which to start updating.
* @param hop If known, ID of the first hop.
* If not known, NULL to find out and pass on children.
*/
uint16_t i;
for (i = 0; i < level; i++)
- fprintf (stderr, " ");
+ FPRINTF (stderr, "%s", " ");
if (n->status == MESH_PEER_READY)
- fprintf (stderr, "#");
+ FPRINTF (stderr, "%s", "#");
if (n->status == MESH_PEER_SEARCHING)
- fprintf (stderr, "+");
+ FPRINTF (stderr, "%s", "+");
if (n->status == MESH_PEER_RELAY)
- fprintf (stderr, "-");
+ FPRINTF (stderr, "%s", "-");
if (n->status == MESH_PEER_RECONNECTING)
- fprintf (stderr, "*");
+ FPRINTF (stderr, "%s", "*");
GNUNET_PEER_resolve (n->peer, &id);
- fprintf (stderr, "%s, [%u, %p] ", GNUNET_i2s (&id), n->peer, n);
+ FPRINTF (stderr, "%s, [%u, %p] ", GNUNET_i2s (&id), n->peer, n);
if (NULL != n->parent)
{
GNUNET_PEER_resolve (n->parent->peer, &id);
- fprintf (stderr, "(-> %s [%u])\n", GNUNET_i2s (&id), n->parent->peer);
+ FPRINTF (stderr, "(-> %s [%u])\n", GNUNET_i2s (&id), n->parent->peer);
}
else
- fprintf (stderr, "(root)\n");
+ FPRINTF (stderr, "%s", "(root)\n");
for (c = n->children_head; NULL != c; c = c->next)
tree_node_debug (c, level + 1);
}
struct MeshTunnelTree *tree;
tree = GNUNET_malloc (sizeof (struct MeshTunnelTree));
- tree->first_hops = GNUNET_CONTAINER_multihashmap_create (32);
+ tree->first_hops = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO);
tree->root = tree_node_new (NULL, peer);
tree->root->status = MESH_PEER_ROOT;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Adding peer %s.\n",
GNUNET_i2s (&id));
GNUNET_PEER_resolve (parent->peer, &id);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: to %s.\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: to %s.\n",
GNUNET_i2s (&id));
#endif
#endif
n = tree_node_new (parent, p->peers[i]);
n->status = MESH_PEER_RELAY;
- if (n->peer == 1)
- {
- t->me = n;
- me = i;
- }
+ }
+ if (n->peer == 1)
+ {
+ t->me = n;
+ me = i;
}
i++;
parent = n;
*
* @return Number of hops to reach destination, UINT_MAX in case the peer is not
* in the path.
- *
+ *
* TODO: adapt to allow any start / root combination
* TODO: take in account state of the nodes
*/
* @return GNUNET_YES if we should continue to iterate, GNUNET_NO if not.
*/
static int
-iterate_free (void *cls, const GNUNET_HashCode * key, void *value)
+iterate_free (void *cls, const struct GNUNET_HashCode * key, void *value)
{
GNUNET_free (value);
return GNUNET_YES;