[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r31799 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r31799 - gnunet/src/mesh |
Date: |
Mon, 6 Jan 2014 06:18:31 +0100 |
Author: bartpolot
Date: 2014-01-06 06:18:30 +0100 (Mon, 06 Jan 2014)
New Revision: 31799
Modified:
gnunet/src/mesh/gnunet-mesh.c
gnunet/src/mesh/gnunet-service-mesh_local.c
gnunet/src/mesh/gnunet-service-mesh_tunnel.c
gnunet/src/mesh/gnunet-service-mesh_tunnel.h
gnunet/src/mesh/mesh_api.c
Log:
- more tunnels info for CLI
Modified: gnunet/src/mesh/gnunet-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-mesh.c 2014-01-06 04:47:44 UTC (rev 31798)
+++ gnunet/src/mesh/gnunet-mesh.c 2014-01-06 05:18:30 UTC (rev 31799)
@@ -122,6 +122,7 @@
shutdown_task (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
if (NULL != ch)
{
GNUNET_MESH_channel_destroy (ch);
@@ -439,10 +440,18 @@
const struct GNUNET_PeerIdentity *peer,
unsigned int channels,
unsigned int connections,
- unsigned int estate,
- unsigned int cstate)
+ uint16_t estate,
+ uint16_t cstate)
{
- FPRINTF (stdout, "%s [%u, %u] CH: %u, C: %u\n",
+ if (NULL == peer)
+ {
+ if (GNUNET_YES != monitor_connections)
+ {
+ GNUNET_SCHEDULER_shutdown();
+ }
+ return;
+ }
+ FPRINTF (stdout, "%s [ENC: %u, CON: %u] CHs: %u, CONNs: %u\n",
GNUNET_i2s_full (peer), estate, cstate, channels, connections);
}
@@ -483,15 +492,12 @@
static void
get_tunnels (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
return;
}
GNUNET_MESH_get_tunnels (mh, &tunnels_callback, NULL);
- if (GNUNET_YES != monitor_connections)
- {
- GNUNET_SCHEDULER_shutdown();
- }
}
Modified: gnunet/src/mesh/gnunet-service-mesh_local.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_local.c 2014-01-06 04:47:44 UTC (rev
31798)
+++ gnunet/src/mesh/gnunet-service-mesh_local.c 2014-01-06 05:18:30 UTC (rev
31799)
@@ -298,7 +298,8 @@
uint32_t *p;
unsigned int i;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\nnew client connected %p\n", client);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "new client connected %p\n", client);
/* Check data sanity */
size = ntohs (message->size) - sizeof (struct GNUNET_MESH_ClientConnect);
@@ -581,7 +582,7 @@
/**
* Iterator over all tunnels to send a monitoring client info about each
tunnel.
*
- * @param cls Closure (client handle).
+ * @param cls Closure ().
* @param peer Peer ID (tunnel remote peer).
* @param value Tunnel info.
*
@@ -599,10 +600,10 @@
msg.header.size = htons (sizeof (msg));
msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS);
msg.destination = *peer;
- msg.channels = htons (42);
- msg.connections = htons (42);
- msg.cstate = htons (GMT_get_cstate (t));
- msg.estate = htons (42);
+ msg.channels = htonl (GMT_count_channels (t));
+ msg.connections = htonl (GMT_count_connections (t));
+ msg.cstate = htons ((uint16_t) GMT_get_cstate (t));
+ msg.estate = htons ((uint16_t) GMT_get_estate (t));
LOG (GNUNET_ERROR_TYPE_DEBUG, "sending info about tunnel ->%s\n",
GNUNET_i2s (peer));
@@ -625,8 +626,7 @@
const struct GNUNET_MessageHeader *message)
{
struct MeshClient *c;
- size_t size;
- struct GNUNET_MessageHeader *reply;
+ struct GNUNET_MessageHeader reply;
/* Sanity check for client registration */
if (NULL == (c = GML_client_get (client)))
@@ -636,21 +636,17 @@
return;
}
- LOG (GNUNET_ERROR_TYPE_INFO, "Received get tunnels request from client %u\n",
- c->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Received get tunnels request from client %u (%p)\n",
+ c->id, client);
- size = GMT_count_all () + 1; /* Last one is all \0 to mark 'end' */
- size *= sizeof (struct GNUNET_PeerIdentity);
- size += sizeof (*reply);
- reply = GNUNET_malloc (size);
- GMT_iterate_all (reply, monitor_all_tunnels_iterator);
- reply->size = htons (size);
- reply->type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS);
- GNUNET_SERVER_notification_context_unicast (nc, client, reply, GNUNET_NO);
+ GMT_iterate_all (client, monitor_all_tunnels_iterator);
+ reply.size = htons (sizeof (reply));
+ reply.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS);
+ GNUNET_SERVER_notification_context_unicast (nc, client, &reply, GNUNET_NO);
- LOG (GNUNET_ERROR_TYPE_INFO,
- "Get tunnels request from client %u completed\n",
- c->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Get tunnels request from client %u completed\n", c->id);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2014-01-06 04:47:44 UTC
(rev 31798)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2014-01-06 05:18:30 UTC
(rev 31799)
@@ -2183,6 +2183,24 @@
/**
+ * Get the encryption state of a tunnel.
+ *
+ * @param t Tunnel.
+ *
+ * @return Tunnel's encryption state.
+ */
+enum MeshTunnel3EState
+GMT_get_estate (struct MeshTunnel3 *t)
+{
+ if (NULL == t)
+ {
+ GNUNET_assert (0);
+ return (enum MeshTunnel3EState) -1;
+ }
+ return t->estate;
+}
+
+/**
* Get the maximum buffer space for a tunnel towards a local client.
*
* @param t Tunnel.
@@ -2387,7 +2405,9 @@
/* Authorize connections to send more data */
to_allow = buffer; /* - allowed; */
- for (iter = t->connection_head; NULL != iter && to_allow > 0; iter =
iter->next)
+ for (iter = t->connection_head;
+ NULL != iter && to_allow > 0;
+ iter = iter->next)
{
allow_per_connection = to_allow/cs;
to_allow -= allow_per_connection;
Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.h 2014-01-06 04:47:44 UTC
(rev 31798)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.h 2014-01-06 05:18:30 UTC
(rev 31799)
@@ -326,6 +326,16 @@
GMT_get_cstate (struct MeshTunnel3 *t);
/**
+ * Get the encryption state of a tunnel.
+ *
+ * @param t Tunnel.
+ *
+ * @return Tunnel's encryption state.
+ */
+enum MeshTunnel3EState
+GMT_get_estate (struct MeshTunnel3 *t);
+
+/**
* Get the maximum buffer space for a tunnel towards a local client.
*
* @param t Tunnel.
Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c 2014-01-06 04:47:44 UTC (rev 31798)
+++ gnunet/src/mesh/mesh_api.c 2014-01-06 05:18:30 UTC (rev 31799)
@@ -1059,8 +1059,8 @@
&msg->destination,
ntohl (msg->channels),
ntohl (msg->connections),
- ntohl (msg->estate),
- ntohl (msg->cstate));
+ ntohs (msg->estate),
+ ntohs (msg->cstate));
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r31799 - gnunet/src/mesh,
gnunet <=