From e37fb97ec361c33e29d89945e68444dcfb9d692b Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Mon, 13 Jan 2014 23:51:23 +0000 Subject: - complete tunnel info gathering --- src/mesh/gnunet-service-mesh_local.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/mesh/gnunet-service-mesh_local.c') diff --git a/src/mesh/gnunet-service-mesh_local.c b/src/mesh/gnunet-service-mesh_local.c index 11812de79..98cd151a6 100644 --- a/src/mesh/gnunet-service-mesh_local.c +++ b/src/mesh/gnunet-service-mesh_local.c @@ -654,11 +654,22 @@ handle_get_tunnels (void *cls, struct GNUNET_SERVER_Client *client, static void iter_connection (void *cls, struct MeshConnection *c) { + struct GNUNET_MESH_LocalInfoTunnel *msg = cls; + struct GNUNET_HashCode *h = (struct GNUNET_HashCode *) &msg[1]; + + h[msg->connections] = *(GMC_get_id (c)); + msg->connections++; } static void iter_channel (void *cls, struct MeshChannel *ch) { + struct GNUNET_MESH_LocalInfoTunnel *msg = cls; + struct GNUNET_HashCode *h = (struct GNUNET_HashCode *) &msg[1]; + MESH_ChannelNumber *chn = (MESH_ChannelNumber *) &h[msg->connections]; + + chn[msg->channels] = GMCH_get_id (ch); + msg->channels++; } @@ -728,6 +739,9 @@ handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client, resp->header.size = htons (size); GMT_iterate_connections (t, &iter_connection, resp); GMT_iterate_channels (t, &iter_channel, resp); + /* Do not interleave with iterators, iter_channel needs conn in HBO */ + resp->connections = htonl (resp->connections); + resp->channels = htonl (resp->channels); resp->cstate = htons (GMT_get_cstate (t)); resp->estate = htons (GMT_get_estate (t)); GNUNET_SERVER_notification_context_unicast (nc, c->handle, -- cgit v1.2.3