[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32204 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32204 - gnunet/src/mesh |
Date: |
Tue, 4 Feb 2014 15:14:13 +0100 |
Author: bartpolot
Date: 2014-02-04 15:14:13 +0100 (Tue, 04 Feb 2014)
New Revision: 32204
Modified:
gnunet/src/mesh/gnunet-service-mesh_channel.c
gnunet/src/mesh/gnunet-service-mesh_connection.c
gnunet/src/mesh/gnunet-service-mesh_peer.c
gnunet/src/mesh/gnunet-service-mesh_tunnel.c
Log:
- refactor logging to allow for shorter log files
Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c 2014-02-04 13:57:36 UTC
(rev 32203)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c 2014-02-04 14:14:13 UTC
(rev 32204)
@@ -1077,16 +1077,15 @@
rel->expected_delay.rel_value_us += time.rel_value_us;
rel->expected_delay.rel_value_us /= 8;
}
- LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! took %s\n",
- GNUNET_STRINGS_relative_time_to_string (time, GNUNET_NO));
- LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! new expected delay %s\n",
- GNUNET_STRINGS_relative_time_to_string (rel->expected_delay,
- GNUNET_NO));
+ LOG (GNUNET_ERROR_TYPE_INFO, "!!! took %s, new delay %s\n",
+ GNUNET_STRINGS_relative_time_to_string (time, GNUNET_NO),
+ GNUNET_STRINGS_relative_time_to_string (rel->expected_delay,
+ GNUNET_NO));
rel->retry_timer = rel->expected_delay;
}
else
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! batch free, ignoring timing\n");
+ LOG (GNUNET_ERROR_TYPE_INFO, "!!! batch free, ignoring timing\n");
}
rel->ch->pending_messages--;
if (NULL != copy->chq)
Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c 2014-02-04 13:57:36 UTC
(rev 32203)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c 2014-02-04 14:14:13 UTC
(rev 32204)
@@ -784,8 +784,8 @@
struct MeshTunnel3 *t;
t = connection->t;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Send connection %s ACK\n",
- GM_f2s (!fwd));
+ LOG (GNUNET_ERROR_TYPE_INFO, "Send %s ACK on connection %s\n",
+ GM_f2s (!fwd), GMC_2s (connection));
GMP_queue_add (get_hop (connection, fwd), NULL,
GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK,
sizeof (struct GNUNET_MESH_ConnectionACK),
@@ -841,6 +841,8 @@
struct GNUNET_MESH_ConnectionBroken *msg;
struct MeshPeer *neighbor;
+ LOG (GNUNET_ERROR_TYPE_INFO, "Send BROKEN on connection %s\n", GMC_2s (c));
+
msg = GNUNET_new (struct GNUNET_MESH_ConnectionBroken);
msg->header.size = htons (sizeof (struct GNUNET_MESH_ConnectionBroken));
msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN);
@@ -1447,6 +1449,22 @@
return path;
}
+
+/**
+ * Log receipt of message on stderr (INFO level).
+ *
+ * @param message Message received.
+ * @param peer Peer who sent the message.
+ */
+static void
+log_message (const struct GNUNET_MessageHeader *message,
+ const struct GNUNET_PeerIdentity *peer)
+{
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
+ LOG (GNUNET_ERROR_TYPE_INFO, "Got a %s message from %s\n",
+ GM_m2s (ntohs (message->type)), GNUNET_i2s (peer));
+}
+
/******************************************************************************/
/******************************** API
***********************************/
/******************************************************************************/
@@ -1475,8 +1493,7 @@
unsigned int own_pos;
uint16_t size;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Received a connection create msg\n");
+ log_message (message, peer);
/* Check size */
size = ntohs (message->size);
@@ -1602,8 +1619,8 @@
enum MeshConnectionState oldstate;
int fwd;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Received a connection ACK msg\n");
+ log_message (message, peer);
+
msg = (struct GNUNET_MESH_ConnectionACK *) message;
LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n",
GNUNET_h2s (&msg->cid));
@@ -1728,8 +1745,8 @@
struct MeshConnection *c;
int fwd;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Received a CONNECTION BROKEN msg from %s\n", GNUNET_i2s (id));
+ log_message (message, id);
+
msg = (struct GNUNET_MESH_ConnectionBroken *) message;
LOG (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n",
GNUNET_i2s (&msg->peer1));
@@ -1781,13 +1798,10 @@
struct MeshConnection *c;
int fwd;
+ log_message (message, peer);
+
msg = (struct GNUNET_MESH_ConnectionDestroy *) message;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Got a CONNECTION DESTROY message from %s\n",
- GNUNET_i2s (peer));
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- " for connection %s\n",
- GNUNET_h2s (&msg->cid));
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", GNUNET_h2s
(&msg->cid));
c = connection_get (&msg->cid);
if (NULL == c)
{
@@ -1844,7 +1858,6 @@
GNUNET_PEER_Id peer_id;
uint32_t pid;
uint32_t ttl;
- uint16_t type;
size_t size;
int fwd;
@@ -1857,10 +1870,6 @@
GNUNET_break_op (0);
return GNUNET_OK;
}
- type = ntohs (msg->header.type);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
- LOG (GNUNET_ERROR_TYPE_DEBUG, "got a %s message (#%u) from %s\n",
- GM_m2s (type), ntohl (msg->pid), GNUNET_i2s (peer));
/* Check connection */
c = connection_get (&msg->cid);
@@ -1872,7 +1881,7 @@
return GNUNET_OK;
}
- LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", GMC_2s (c));
+ LOG (GNUNET_ERROR_TYPE_INFO, " on connection %s\n", GMC_2s (c));
/* Check if origin is as expected */
neighbor = get_prev_hop (c);
@@ -1972,7 +1981,6 @@
struct MeshPeer *neighbor;
GNUNET_PEER_Id peer_id;
size_t size;
- uint16_t type;
int fwd;
/* Check size */
@@ -1984,10 +1992,6 @@
GNUNET_break_op (0);
return GNUNET_OK;
}
- type = ntohs (msg->header.type);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
- LOG (GNUNET_ERROR_TYPE_DEBUG, "got a %s message from %s\n",
- GM_m2s (type), GNUNET_i2s (peer));
/* Check connection */
c = connection_get (&msg->cid);
@@ -2071,6 +2075,8 @@
GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message)
{
+ log_message (message, peer);
+
return handle_mesh_encrypted (peer,
(struct GNUNET_MESH_Encrypted *)message);
}
@@ -2090,6 +2096,8 @@
GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message)
{
+ log_message (message, peer);
+
return handle_mesh_kx (peer,
(struct GNUNET_MESH_KX *) message);
}
@@ -2116,13 +2124,10 @@
uint32_t ack;
int fwd;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK packet from %s!\n",
- GNUNET_i2s (peer));
+ log_message (message, peer);
+
msg = (struct GNUNET_MESH_ACK *) message;
-
c = connection_get (&msg->cid);
-
if (NULL == c)
{
GNUNET_STATISTICS_update (stats, "# ack on unknown connection", 1,
@@ -2193,15 +2198,10 @@
uint32_t pid;
int fwd;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Got a POLL message from %s!\n",
- GNUNET_i2s (peer));
+ log_message (message, peer);
msg = (struct GNUNET_MESH_Poll *) message;
-
c = connection_get (&msg->cid);
-
if (NULL == c)
{
GNUNET_STATISTICS_update (stats, "# poll on unknown connection", 1,
@@ -2265,10 +2265,9 @@
GNUNET_PEER_Id peer_id;
int fwd;
+ log_message (message, peer);
+
msg = (struct GNUNET_MESH_ConnectionKeepAlive *) message;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "got a keepalive packet from %s\n",
- GNUNET_i2s (peer));
-
c = connection_get (&msg->cid);
if (NULL == c)
{
@@ -2824,7 +2823,7 @@
data = GNUNET_malloc (size);
memcpy (data, message, size);
type = ntohs (message->type);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Send %s (%u bytes) on connection %s\n",
+ LOG (GNUNET_ERROR_TYPE_INFO, "Send %s (%u bytes) on connection %s\n",
GM_m2s (type), size, GMC_2s (c));
fc = fwd ? &c->fwd_fc : &c->bck_fc;
@@ -2982,7 +2981,9 @@
size = sizeof (struct GNUNET_MESH_ConnectionCreate);
size += connection->path->length * sizeof (struct GNUNET_PeerIdentity);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Send connection create\n");
+ LOG (GNUNET_ERROR_TYPE_INFO, "Send %s (%u bytes) on connection %s\n",
+ GM_m2s (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE),
+ size, GMC_2s (connection));
LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u (create)\n",
connection, connection->pending_messages);
connection->pending_messages++;
Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c 2014-02-04 13:57:36 UTC (rev
32203)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c 2014-02-04 14:14:13 UTC (rev
32204)
@@ -1073,7 +1073,7 @@
int priority;
int call_core;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_INFO,
"queue add %s %s towards %s (size %u) on c %p (%s)\n",
GM_f2s (fwd), GM_m2s (type), GMP_2s(peer),
size, c, GMC_2s (c));
Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2014-02-04 13:57:36 UTC
(rev 32203)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2014-02-04 14:14:13 UTC
(rev 32204)
@@ -1548,9 +1548,7 @@
uint16_t type;
type = ntohs (msgh->type);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Got a %s message!\n",
- GM_m2s (type));
+ LOG (GNUNET_ERROR_TYPE_INFO, "Got a %s message\n", GM_m2s (type));
switch (type)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32204 - gnunet/src/mesh,
gnunet <=