struct MeshTunnel **tunnels;
/**
- * Number of tunnels above
+ * Number of tunnels this peers participates in
*/
unsigned int ntunnels;
};
}
else
{
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: Adding from GET: %s.\n",
+ GNUNET_i2s(&get_path[i]));
p->length++;
p->peers = GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) * p->length);
- p->peers[p->length] = id;
+ p->peers[p->length - 1] = id;
}
}
i = put_path_length;
}
else
{
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: Adding from PUT: %s.\n",
+ GNUNET_i2s(&put_path[i]));
p->length++;
p->peers = GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) * p->length);
- p->peers[p->length] = id;
+ p->peers[p->length - 1] = id;
}
}
#if MESH_DEBUG
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"MESH: In total: %d hops\n",
p->length);
+ for (i = 0; i < p->length; i++)
+ {
+ struct GNUNET_PeerIdentity peer_id;
+
+ GNUNET_PEER_resolve(p->peers[i], &peer_id);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: %u: %s\n",
+ p->peers[i],
+ GNUNET_h2s_full(&peer_id.hashPubKey));
+ }
#endif
return p;
}
/**
* Add a peer to a tunnel, accomodating paths accordingly and initializing all
* needed rescources.
+ * If peer already exists, do nothing.
*
* @param t Tunnel we want to add a new peer to
* @param peer PeerInfo of the peer being added
if (GNUNET_SCHEDULER_NO_TASK == t->path_refresh_task)
t->path_refresh_task =
GNUNET_SCHEDULER_add_delayed (t->tree->refresh, &path_refresh, t);
-
}