[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29980 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29980 - gnunet/src/mesh |
Date: |
Tue, 8 Oct 2013 13:15:01 +0200 |
Author: bartpolot
Date: 2013-10-08 13:15:01 +0200 (Tue, 08 Oct 2013)
New Revision: 29980
Modified:
gnunet/src/mesh/gnunet-service-mesh_channel.c
gnunet/src/mesh/gnunet-service-mesh_connection.c
gnunet/src/mesh/gnunet-service-mesh_dht.c
gnunet/src/mesh/gnunet-service-mesh_local.c
gnunet/src/mesh/gnunet-service-mesh_peer.c
gnunet/src/mesh/gnunet-service-mesh_tunnel.c
Log:
- use per-module logging
Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c 2013-10-08 11:12:41 UTC
(rev 29979)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c 2013-10-08 11:15:01 UTC
(rev 29980)
@@ -25,8 +25,8 @@
#include "gnunet-service-mesh_channel.h"
#include "gnunet-service-mesh_local.h"
+#define LOG (level, ...) GNUNET_log_from ("mesh-chn", level, __VA_ARGS__)
-
/**
* All the states a connection can be in.
*/
@@ -264,7 +264,7 @@
size = ntohs (msg->header.size);
mid = ntohl (msg->mid);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "add_buffered_data %u\n", mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "add_buffered_data %u\n", mid);
copy = GNUNET_malloc (sizeof (*copy) + size);
copy->mid = mid;
@@ -277,18 +277,18 @@
// FIXME start from the end (most messages are the latest ones)
for (prev = rel->head_recv; NULL != prev; prev = prev->next)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " prev %u\n", prev->mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " prev %u\n", prev->mid);
if (GMC_is_pid_bigger (prev->mid, mid))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " bingo!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " bingo!\n");
GNUNET_CONTAINER_DLL_insert_before (rel->head_recv, rel->tail_recv,
prev, copy);
return;
}
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " insert at tail!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " insert at tail!\n");
GNUNET_CONTAINER_DLL_insert_tail (rel->head_recv, rel->tail_recv, copy);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "add_buffered_data END\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "add_buffered_data END\n");
}
@@ -335,11 +335,11 @@
static struct MeshChannel *
channel_get_by_local_id (struct MeshClient *c, MESH_ChannelNumber chid)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " -- get CHID %X\n", chid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " -- get CHID %X\n", chid);
if (0 == (chid & GNUNET_MESH_LOCAL_CHANNEL_ID_CLI))
{
GNUNET_break_op (0);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CHID %X not a local chid\n", chid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "CHID %X not a local chid\n", chid);
return NULL;
}
if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV)
@@ -536,45 +536,45 @@
bitfield = msg->futures;
mid = ntohl (msg->mid);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"free_sent_reliable %u %llX\n",
mid, bitfield);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" rel %p, head %p\n",
rel, rel->head_sent);
for (i = 0, copy = rel->head_sent;
i < 64 && NULL != copy && 0 != bitfield;
i++)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" trying bit %u (mid %u)\n",
i, mid + i + 1);
mask = 0x1LL << i;
if (0 == (bitfield & mask))
continue;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " set!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " set!\n");
/* Bit was set, clear the bit from the bitfield */
bitfield &= ~mask;
/* The i-th bit was set. Do we have that copy? */
/* Skip copies with mid < target */
target = mid + i + 1;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " target %u\n", target);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " target %u\n", target);
while (NULL != copy && GMC_is_pid_bigger (target, copy->mid))
copy = copy->next;
/* Did we run out of copies? (previously freed, it's ok) */
if (NULL == copy)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "run out of copies...\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "run out of copies...\n");
return;
}
/* Did we overshoot the target? (previously freed, it's ok) */
if (GMC_is_pid_bigger (copy->mid, target))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " next copy %u\n", copy->mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " next copy %u\n", copy->mid);
continue;
}
@@ -583,7 +583,7 @@
rel_message_free (copy);
copy = next;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "free_sent_reliable END\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "free_sent_reliable END\n");
}
@@ -646,14 +646,14 @@
/* Message not found in the queue that we are going to use. */
if (NULL == q)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! RETRANSMIT %u\n", copy->mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! RETRANSMIT %u\n", copy->mid);
send_prebuilt_message_channel (&payload->header, ch, fwd);
GNUNET_STATISTICS_update (stats, "# data retransmitted", 1, GNUNET_NO);
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! ALREADY IN QUEUE %u\n",
copy->mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! ALREADY IN QUEUE %u\n", copy->mid);
}
rel->retry_timer = GNUNET_TIME_STD_BACKOFF (rel->retry_timer);
@@ -684,7 +684,7 @@
uint32_t allow_per_connection;
unsigned int cs;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Channel send connection %s ack on %s:%X\n",
fwd ? "FWD" : "BCK", peer2s (ch->t->peer), ch->gid);
@@ -724,7 +724,7 @@
connection_send_ack (c, allow_per_connection, fwd);
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Channel send connection %s ack on %s:%X\n",
fwd ? "FWD" : "BCK", peer2s (ch->t->peer), ch->gid);
GNUNET_break (to_allow == 0);
@@ -750,11 +750,11 @@
rel->expected_delay.rel_value_us += time.rel_value_us;
rel->expected_delay.rel_value_us /= 8;
rel->n_sent--;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Freeing %u\n", copy->mid);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " n_sent %u\n", rel->n_sent);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! took %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Freeing %u\n", copy->mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " n_sent %u\n", rel->n_sent);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! took %s\n",
GNUNET_STRINGS_relative_time_to_string (time, GNUNET_NO));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! new expected delay %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! new expected delay %s\n",
GNUNET_STRINGS_relative_time_to_string (rel->expected_delay,
GNUNET_NO));
rel->retry_timer = rel->expected_delay;
@@ -777,7 +777,7 @@
struct MeshReliableMessage *copy;
struct MeshReliableMessage *next;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" channel confirm %s %s:%X\n",
fwd ? "FWD" : "BCK", peer2s (ch->t->peer), ch->gid);
ch->state = MESH_CHANNEL_READY;
@@ -824,7 +824,7 @@
type = ntohs (msg->type);
size = ntohs (msg->size);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! SAVE %u\n", mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SAVE %u\n", mid);
copy = GNUNET_malloc (sizeof (struct MeshReliableMessage) + size);
copy->mid = mid;
copy->timestamp = GNUNET_TIME_absolute_get ();
@@ -832,7 +832,7 @@
copy->type = type;
memcpy (©[1], msg, size);
rel->n_sent++;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " n_sent %u\n", rel->n_sent);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " n_sent %u\n", rel->n_sent);
GNUNET_CONTAINER_DLL_insert_tail (rel->head_sent, rel->tail_sent, copy);
if (GNUNET_SCHEDULER_NO_TASK == rel->retry_task)
{
@@ -865,11 +865,11 @@
struct MeshReliableMessage *copy;
struct MeshChannelReliability *rel;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "send_buffered_data\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "send_buffered_data\n");
rel = fwd ? ch->dest_rel : ch->root_rel;
if (GNUNET_NO == rel->client_ready)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "client not ready\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "client not ready\n");
return;
}
@@ -881,7 +881,7 @@
{
struct GNUNET_MESH_Data *msg = (struct GNUNET_MESH_Data *) ©[1];
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" have %u! now expecting %u\n",
copy->mid, rel->mid_recv + 1);
send_client_data (ch, msg, fwd);
@@ -892,14 +892,14 @@
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" reliable && don't have %u, next is %u\n",
rel->mid_recv,
copy->mid);
return;
}
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "send_buffered_data END\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "send_buffered_data END\n");
}
@@ -918,7 +918,7 @@
if (NULL == ch)
return;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "destroying channel %s:%u\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying channel %s:%u\n",
peer2s (ch->t->peer), ch->gid);
GMCH_debug (ch);
@@ -979,7 +979,7 @@
{
while (NULL != channel_get (t, t->next_chid))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Channel %u exists (%p)...\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %u exists (%p)...\n",
t->next_chid, channel_get (t, t->next_chid));
t->next_chid = (t->next_chid + 1) & ~GNUNET_MESH_LOCAL_CHANNEL_ID_CLI;
}
@@ -1032,7 +1032,7 @@
msg.header.size = htons (sizeof (msg));
msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" sending channel %s ack for channel %s:%X\n",
fwd ? "FWD" : "BCK", peer2s (ch->t->peer),
ch->gid);
@@ -1058,7 +1058,7 @@
msg.header.size = htons (sizeof (msg));
msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" sending channel destroy for channel %s:%X\n",
peer2s (ch->t->peer),
ch->gid);
@@ -1111,18 +1111,18 @@
struct MeshClient *c = cls;
struct MeshTunnel2 *t;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" Channel %X (%X / %X) destroy, due to client %u shutdown.\n",
ch->gid, ch->lid_root, ch->lid_dest, c->id);
channel_debug (ch);
if (c == ch->dest)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Client %u is destination.\n",
c->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Client %u is destination.\n", c->id);
}
if (c == ch->root)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Client %u is owner.\n", c->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Client %u is owner.\n", c->id);
}
t = ch->t;
@@ -1153,9 +1153,9 @@
uint16_t type;
uint64_t iv;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send on Channel %s:%X %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Send on Channel %s:%X %s\n",
peer2s (ch->t->peer), ch->gid, fwd ? "FWD" : "BCK");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " %s\n",
GNUNET_MESH_DEBUG_M2S (ntohs (message->type)));
if (channel_is_terminal (ch, fwd) || ch->t->peer->id == myid)
@@ -1263,7 +1263,7 @@
return;
}
rel = fwd ? ch->dest_rel : ch->root_rel;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"send_data_ack for %u\n",
rel->mid_recv - 1);
@@ -1282,14 +1282,14 @@
break;
mask = 0x1LL << delta;
msg.futures |= mask;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" setting bit for %u (delta %u) (%llX) -> %llX\n",
copy->mid, delta, mask, msg.futures);
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " final futures %llX\n", msg.futures);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " final futures %llX\n", msg.futures);
send_prebuilt_message_channel (&msg.header, ch, fwd);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "send_data_ack END\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "send_data_ack END\n");
}
@@ -1303,28 +1303,28 @@
{
if (NULL == ch)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "*** DEBUG NULL CHANNEL ***\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "*** DEBUG NULL CHANNEL ***\n");
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Channel %s:%X (%p)\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %s:%X (%p)\n",
peer2s (ch->t->peer), ch->gid, ch);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " root %p/%p\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " root %p/%p\n",
ch->root, ch->root_rel);
if (NULL != ch->root)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " cli %u\n", ch->root->id);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ready %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " cli %u\n", ch->root->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " ready %s\n",
ch->root_rel->client_ready ? "YES" : "NO");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " id %X\n", ch->lid_root);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " id %X\n", ch->lid_root);
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " dest %p/%p\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " dest %p/%p\n",
ch->dest, ch->dest_rel);
if (NULL != ch->dest)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " cli %u\n", ch->dest->id);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ready %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " cli %u\n", ch->dest->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " ready %s\n",
ch->dest_rel->client_ready ? "YES" : "NO");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " id %X\n", ch->lid_dest);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " id %X\n", ch->lid_dest);
}
}
@@ -1358,9 +1358,9 @@
return;
}
type = ntohs (msg->header.type);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got a %s message\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "got a %s message\n",
GNUNET_MESH_DEBUG_M2S (type));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " payload of type %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " payload of type %s\n",
GNUNET_MESH_DEBUG_M2S (ntohs (msg[1].header.type)));
/* Check channel */
@@ -1368,7 +1368,7 @@
if (NULL == ch)
{
GNUNET_STATISTICS_update (stats, "# data on unknown channel", 1,
GNUNET_NO);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "WARNING channel %u unknown\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING channel %u unknown\n",
ntohl (msg->chid));
return;
}
@@ -1388,25 +1388,25 @@
GNUNET_STATISTICS_update (stats, "# data received", 1, GNUNET_NO);
mid = ntohl (msg->mid);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " mid %u\n", mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " mid %u\n", mid);
if (GNUNET_NO == ch->reliable ||
( !GMC_is_pid_bigger (rel->mid_recv, mid) &&
GMC_is_pid_bigger (rel->mid_recv + 64, mid) ) )
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! RECV %u\n", mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! RECV %u\n", mid);
if (GNUNET_YES == ch->reliable)
{
/* Is this the exact next expected messasge? */
if (mid == rel->mid_recv)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "as expected\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "as expected\n");
rel->mid_recv++;
send_client_data (ch, msg, fwd);
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "save for later\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "save for later\n");
add_buffered_data (msg, rel);
}
}
@@ -1421,7 +1421,7 @@
else
{
GNUNET_break_op (0);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" MID %u not expected (%u - %u), dropping!\n",
mid, rel->mid_recv, rel->mid_recv + 64);
}
@@ -1451,7 +1451,7 @@
int work;
type = ntohs (msg->header.type);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got a %s message!\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a %s message!\n",
GNUNET_MESH_DEBUG_M2S (type));
ch = channel_get (t, ntohl (msg->chid));
if (NULL == ch)
@@ -1460,7 +1460,7 @@
return;
}
ack = ntohl (msg->mid);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! %s ACK %u\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! %s ACK %u\n",
(GNUNET_YES == fwd) ? "FWD" : "BCK", ack);
if (GNUNET_YES == fwd)
@@ -1481,12 +1481,12 @@
{
if (GMC_is_pid_bigger (copy->mid, ack))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! head %u, out!\n", copy->mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! head %u, out!\n", copy->mid);
channel_rel_free_sent (rel, msg);
break;
}
work = GNUNET_YES;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! id %u\n", copy->mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! id %u\n", copy->mid);
next = copy->next;
rel_message_free (copy);
}
@@ -1542,7 +1542,7 @@
struct MeshClient *c;
uint32_t port;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received Channel Create\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Received Channel Create\n");
/* Check message size */
if (ntohs (msg->header.size) != sizeof (struct GNUNET_MESH_ChannelCreate))
{
@@ -1552,15 +1552,15 @@
/* Check if channel exists */
chid = ntohl (msg->chid);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " chid %u\n", chid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " chid %u\n", chid);
ch = channel_get (t, chid);
if (NULL != ch)
{
/* Probably a retransmission, safe to ignore */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " already exists...\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " already exists...\n");
if (NULL != ch->dest)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " duplicate CC!!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " duplicate CC!!\n");
GMCH_send_ack (ch, !fwd);
return;
}
@@ -1575,19 +1575,19 @@
/* Find a destination client */
port = ntohl (msg->port);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " port %u\n", port);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " port %u\n", port);
c = GNUNET_CONTAINER_multihashmap32_get (ports, port);
if (NULL == c)
{
/* TODO send reject */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " no client has port registered\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " no client has port registered\n");
/* TODO free ch */
return;
}
channel_add_client (ch, c);
if (GNUNET_YES == ch->reliable)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Reliable\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Reliable\n");
GMCH_send_create (ch);
GMCH_send_ack (ch, fwd);
@@ -1610,7 +1610,7 @@
MESH_ChannelNumber chid;
struct MeshChannel *ch;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received Channel ACK\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Received Channel ACK\n");
/* Check message size */
if (ntohs (msg->header.size) != sizeof (struct GNUNET_MESH_ChannelManage))
{
@@ -1624,7 +1624,7 @@
if (NULL == ch)
{
GNUNET_break_op (0);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " channel %u unknown!!\n", chid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " channel %u unknown!!\n", chid);
return;
}
Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c 2013-10-08 11:12:41 UTC
(rev 29979)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c 2013-10-08 11:15:01 UTC
(rev 29980)
@@ -39,6 +39,7 @@
#define MESH_RETRANSMIT_TIME GNUNET_TIME_UNIT_SECONDS
#define MESH_RETRANSMIT_MARGIN 4
+#define LOG (level, ...) GNUNET_log_from ("mesh-con", level, __VA_ARGS__)
/**
* All the states a connection can be in.
@@ -275,11 +276,11 @@
static void
fc_debug (struct MeshFlowControl *fc)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " IN: %u/%u\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " IN: %u/%u\n",
fc->last_pid_recv, fc->last_ack_sent);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " OUT: %u/%u\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " OUT: %u/%u\n",
fc->last_pid_sent, fc->last_ack_recv);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " QUEUE: %u/%u\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " QUEUE: %u/%u\n",
fc->queue_n, fc->queue_max);
}
@@ -288,16 +289,16 @@
{
if (NULL == c)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "*** DEBUG NULL CONNECTION ***\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "*** DEBUG NULL CONNECTION ***\n");
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connection %s:%X\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s:%X\n",
peer2s (c->t->peer), GNUNET_h2s (&c->id));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " state: %u, pending msgs: %u\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " state: %u, pending msgs: %u\n",
c->state, c->pending_messages);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " FWD FC\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " FWD FC\n");
fc_debug (&c->fwd_fc);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " BCK FC\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " BCK FC\n");
fc_debug (&c->bck_fc);
}
#endif
@@ -383,15 +384,15 @@
next_fc = fwd ? &c->fwd_fc : &c->bck_fc;
prev_fc = fwd ? &c->bck_fc : &c->fwd_fc;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"connection send %s ack on %s\n",
fwd ? "FWD" : "BCK", GNUNET_h2s (&c->id));
/* Check if we need to transmit the ACK */
if (prev_fc->last_ack_sent - prev_fc->last_pid_recv > 3)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Not sending ACK, buffer > 3\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Not sending ACK, buffer > 3\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" last pid recv: %u, last ack sent: %u\n",
prev_fc->last_pid_recv, prev_fc->last_ack_sent);
return;
@@ -400,14 +401,14 @@
/* Ok, ACK might be necessary, what PID to ACK? */
delta = next_fc->queue_max - next_fc->queue_n;
ack = prev_fc->last_pid_recv + delta;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ACK %u\n", ack);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " ACK %u\n", ack);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" last pid %u, last ack %u, qmax %u, q %u\n",
prev_fc->last_pid_recv, prev_fc->last_ack_sent,
next_fc->queue_max, next_fc->queue_n);
if (ack == prev_fc->last_ack_sent)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Not sending FWD ACK, not needed\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Not sending FWD ACK, not needed\n");
return;
}
@@ -436,7 +437,7 @@
struct MeshTunnel2 *t;
t = connection->t;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send connection ack\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Send connection ack\n");
queue_add (NULL,
GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK,
sizeof (struct GNUNET_MESH_ConnectionACK),
@@ -462,7 +463,7 @@
struct MeshTunnel2 *t;
t = connection->t;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send connection create\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Send connection create\n");
queue_add (NULL,
GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE,
sizeof (struct GNUNET_MESH_ConnectionCreate) +
@@ -483,10 +484,10 @@
connection_change_state (struct MeshConnection* c,
enum MeshConnectionState state)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Connection %s state was %s\n",
GNUNET_h2s (&c->id), GNUNET_MESH_DEBUG_CS2S (c->state));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Connection %s state is now %s\n",
GNUNET_h2s (&c->id), GNUNET_MESH_DEBUG_CS2S (state));
c->state = state;
@@ -511,7 +512,7 @@
type = fwd ? GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE :
GNUNET_MESSAGE_TYPE_MESH_BCK_KEEPALIVE;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"sending %s keepalive for connection %s[%d]\n",
fwd ? "FWD" : "BCK",
peer2s (c->t->peer),
@@ -535,7 +536,7 @@
static void
connection_recreate (struct MeshConnection *c, int fwd)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sending connection recreate\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "sending connection recreate\n");
if (fwd)
send_connection_create (c);
else
@@ -624,7 +625,7 @@
msg.header.size = htons (sizeof (msg));
msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY);;
msg.cid = c->id;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" sending connection destroy for connection %s[%X]\n",
peer2s (c->t->peer),
c->id);
@@ -701,13 +702,13 @@
struct MeshPeerQueue *q;
size_t size;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"connection_unlock_queue %s on %s\n",
fwd ? "FWD" : "BCK", GNUNET_h2s (&c->id));
if (GMC_is_terminal (c, fwd))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " is terminal!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " is terminal!\n");
return;
}
@@ -715,14 +716,14 @@
if (NULL != peer->core_transmit)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " already unlocked!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " already unlocked!\n");
return; /* Already unlocked */
}
q = connection_get_first_message (c, fwd);
if (NULL == q)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " queue empty!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " queue empty!\n");
return; /* Nothing to transmit */
}
@@ -766,7 +767,7 @@
next = q->next;
if (q->c == c)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"connection_cancel_queue %s\n",
GNUNET_MESH_DEBUG_M2S (q->type));
queue_destroy (q, GNUNET_YES);
@@ -811,15 +812,15 @@
}
c = fc->c;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** Polling!\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** connection [%X]\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Polling!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " *** connection [%X]\n",
GNUNET_h2s (&c->id));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " *** %s\n",
fc == &c->fwd_fc ? "FWD" : "BCK");
msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_POLL);
msg.header.size = htons (sizeof (msg));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** pid (%u)!\n", fc->last_pid_sent);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " *** pid (%u)!\n", fc->last_pid_sent);
send_prebuilt_message_connection (&msg.header, c, NULL, fc == &c->fwd_fc);
fc->poll_time = GNUNET_TIME_STD_BACKOFF (fc->poll_time);
fc->poll_task = GNUNET_SCHEDULER_add_delayed (fc->poll_time,
@@ -906,7 +907,7 @@
c->fwd_maintenance_task = GNUNET_SCHEDULER_NO_TASK;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Connection %s[%X] FWD timed out. Destroying.\n",
peer2s (c->t->peer),
c->id);
@@ -935,7 +936,7 @@
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Connection %s[%X] FWD timed out. Destroying.\n",
peer2s (c->t->peer),
c->id);
@@ -988,9 +989,6 @@
}
-
-
-
/**
* Core handler for connection creation.
*
@@ -1016,8 +1014,8 @@
uint16_t size;
uint16_t i;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received a connection create msg\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Received a connection create msg\n");
/* Check size */
size = ntohs (message->size);
@@ -1040,13 +1038,13 @@
GNUNET_break_op (0);
return GNUNET_OK;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " path has %u hops.\n", size);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " path has %u hops.\n", size);
/* Get parameters */
msg = (struct GNUNET_MESH_ConnectionCreate *) message;
cid = &msg->cid;
id = (struct GNUNET_PeerIdentity *) &msg[1];
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" connection %s (%s).\n",
GNUNET_h2s (cid), GNUNET_i2s (id));
@@ -1054,19 +1052,19 @@
c = connection_get (cid);
if (NULL == c)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Creating connection\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Creating connection\n");
c = connection_new (cid);
if (NULL == c)
return GNUNET_OK;
connection_reset_timeout (c, GNUNET_YES);
/* Create path */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Creating path...\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Creating path...\n");
path = path_new (size);
own_pos = 0;
for (i = 0; i < size; i++)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ... adding %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " ... adding %s\n",
GNUNET_i2s (&id[i]));
path->peers[i] = GNUNET_PEER_intern (&id[i]);
if (path->peers[i] == myid)
@@ -1080,7 +1078,7 @@
connection_destroy (c);
return GNUNET_OK;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos);
path_add_to_peers (path, GNUNET_NO);
c->path = path_duplicate (path);
c->own_pos = own_pos;
@@ -1099,7 +1097,7 @@
/* Is it a connection to us? */
if (c->own_pos == size - 1)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n");
peer_add_path_to_origin (orig_peer, path, GNUNET_YES);
if (NULL == orig_peer->tunnel)
@@ -1121,7 +1119,7 @@
else
{
/* It's for somebody else! Retransmit. */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Retransmitting.\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Retransmitting.\n");
peer_add_path (dest_peer, path_duplicate (path), GNUNET_NO);
peer_add_path_to_origin (orig_peer, path, GNUNET_NO);
send_prebuilt_message_connection (message, c, NULL, GNUNET_YES);
@@ -1150,34 +1148,34 @@
struct MeshPeer *pi;
int fwd;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received a connection ACK msg\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Received a connection ACK msg\n");
msg = (struct GNUNET_MESH_ConnectionACK *) message;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n",
GNUNET_h2s (&msg->cid));
c = connection_get (&msg->cid);
if (NULL == c)
{
GNUNET_STATISTICS_update (stats, "# control on unknown connection",
1, GNUNET_NO);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " don't know the connection!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " don't know the connection!\n");
return GNUNET_OK;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " via peer %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " via peer %s\n",
GNUNET_i2s (peer));
pi = peer_get (peer);
if (connection_get_next_hop (c) == pi)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " SYNACK\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " SYNACK\n");
fwd = GNUNET_NO;
if (MESH_CONNECTION_SENT == c->state)
connection_change_state (c, MESH_CONNECTION_ACK);
}
else if (connection_get_prev_hop (c) == pi)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ACK\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " ACK\n");
fwd = GNUNET_YES;
connection_change_state (c, MESH_CONNECTION_READY);
}
@@ -1202,7 +1200,7 @@
/* Message for us as creator? */
if (connection_is_origin (c, GNUNET_YES))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Connection (SYN)ACK for us!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Connection (SYN)ACK for us!\n");
connection_change_state (c, MESH_CONNECTION_READY);
if (MESH_TUNNEL_READY != c->t->state)
tunnel_change_state (c->t, MESH_TUNNEL_READY);
@@ -1219,7 +1217,7 @@
/* Message for us as destination? */
if (GMC_is_terminal (c, GNUNET_YES))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Connection ACK for us!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Connection ACK for us!\n");
if (MESH_TUNNEL_READY != c->t->state)
tunnel_change_state (c->t, MESH_TUNNEL_READY);
connection_change_state (c, MESH_CONNECTION_READY);
@@ -1227,7 +1225,7 @@
return GNUNET_OK;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n");
send_prebuilt_message_connection (message, c, NULL, fwd);
return GNUNET_OK;
}
@@ -1250,12 +1248,12 @@
struct GNUNET_MESH_ConnectionBroken *msg;
struct MeshConnection *c;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Received a CONNECTION BROKEN msg from %s\n", GNUNET_i2s (peer));
msg = (struct GNUNET_MESH_ConnectionBroken *) message;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n",
GNUNET_i2s (&msg->peer1));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n",
GNUNET_i2s (&msg->peer2));
c = connection_get (&msg->cid);
if (NULL == c)
@@ -1290,10 +1288,10 @@
int fwd;
msg = (struct GNUNET_MESH_ConnectionDestroy *) message;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Got a CONNECTION DESTROY message from %s\n",
GNUNET_i2s (peer));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" for connection %s\n",
GNUNET_h2s (&msg->cid));
c = connection_get (&msg->cid);
@@ -1357,8 +1355,8 @@
return GNUNET_OK;
}
type = ntohs (msg->header.type);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got a %s message from %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "got a %s message from %s\n",
GNUNET_MESH_DEBUG_M2S (type), GNUNET_i2s (peer));
/* Check connection */
@@ -1366,7 +1364,7 @@
if (NULL == c)
{
GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "WARNING connection unknown\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING connection unknown\n");
return GNUNET_OK;
}
t = c->t;
@@ -1385,7 +1383,7 @@
if (GMC_is_pid_bigger (pid, fc->last_ack_sent))
{
GNUNET_STATISTICS_update (stats, "# unsolicited message", 1, GNUNET_NO);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"WARNING Received PID %u, (prev %u), ACK %u\n",
pid, fc->last_pid_recv, fc->last_ack_sent);
return GNUNET_OK;
@@ -1393,7 +1391,7 @@
if (GNUNET_NO == GMC_is_pid_bigger (pid, fc->last_pid_recv))
{
GNUNET_STATISTICS_update (stats, "# duplicate PID", 1, GNUNET_NO);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
" Pid %u not expected (%u+), dropping!\n",
pid, fc->last_pid_recv + 1);
return GNUNET_OK;
@@ -1412,7 +1410,7 @@
unsigned int off;
/* TODO signature verification */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " message for us!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " message for us!\n");
GNUNET_STATISTICS_update (stats, "# messages received", 1, GNUNET_NO);
fc->last_pid_recv = pid;
@@ -1429,13 +1427,13 @@
}
/* Message not for us: forward to next hop */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n");
ttl = ntohl (msg->ttl);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ttl: %u\n", ttl);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " ttl: %u\n", ttl);
if (ttl == 0)
{
GNUNET_STATISTICS_update (stats, "# TTL drops", 1, GNUNET_NO);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, " TTL is 0, DROPPING!\n");
+ LOG (GNUNET_ERROR_TYPE_WARNING, " TTL is 0, DROPPING!\n");
send_ack (c, NULL, fwd);
return GNUNET_OK;
}
@@ -1507,8 +1505,8 @@
uint32_t ack;
int fwd;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK packet from %s!\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK packet from %s!\n",
GNUNET_i2s (peer));
msg = (struct GNUNET_MESH_ACK *) message;
@@ -1525,13 +1523,13 @@
id = GNUNET_PEER_search (peer);
if (connection_get_next_hop (c)->id == id)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK\n");
fc = &c->fwd_fc;
fwd = GNUNET_YES;
}
else if (connection_get_prev_hop (c)->id == id)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " BCK ACK\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " BCK ACK\n");
fc = &c->bck_fc;
fwd = GNUNET_NO;
}
@@ -1542,7 +1540,7 @@
}
ack = ntohl (msg->ack);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ACK %u (was %u)\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " ACK %u (was %u)\n",
ack, fc->last_ack_recv);
if (GMC_is_pid_bigger (ack, fc->last_ack_recv))
fc->last_ack_recv = ack;
@@ -1551,7 +1549,7 @@
if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task &&
GMC_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Cancel poll\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Cancel poll\n");
GNUNET_SCHEDULER_cancel (fc->poll_task);
fc->poll_task = GNUNET_SCHEDULER_NO_TASK;
fc->poll_time = GNUNET_TIME_UNIT_SECONDS;
@@ -1584,8 +1582,8 @@
uint32_t pid;
int fwd;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got a POLL packet from %s!\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "\n\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a POLL packet from %s!\n",
GNUNET_i2s (peer));
msg = (struct GNUNET_MESH_Poll *) message;
@@ -1608,12 +1606,12 @@
id = GNUNET_PEER_search (peer);
if (connection_get_next_hop (c)->id == id)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK\n");
fc = &c->fwd_fc;
}
else if (connection_get_prev_hop (c)->id == id)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " BCK ACK\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " BCK ACK\n");
fc = &c->bck_fc;
}
else
@@ -1623,7 +1621,7 @@
}
pid = ntohl (msg->pid);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " PID %u, OLD %u\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " PID %u, OLD %u\n",
pid, fc->last_pid_recv);
fc->last_pid_recv = pid;
fwd = fc == &c->fwd_fc;
@@ -1654,7 +1652,7 @@
int fwd;
msg = (struct GNUNET_MESH_ConnectionKeepAlive *) message;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got a keepalive packet from %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "got a keepalive packet from %s\n",
GNUNET_i2s (peer));
c = connection_get (&msg->cid);
@@ -1702,41 +1700,41 @@
{
unsigned int buffer;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"send ack %s on %p %p\n",
fwd ? "FWD" : "BCK", c, ch);
if (NULL == c || GMC_is_terminal (c, fwd))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " getting from all connections\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " getting from all connections\n");
buffer = tunnel_get_buffer (NULL == c ? ch->t : c->t, fwd);
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " getting from one connection\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " getting from one connection\n");
buffer = connection_get_buffer (c, fwd);
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " buffer available: %u\n", buffer);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer available: %u\n", buffer);
if ( (NULL != ch && channel_is_origin (ch, fwd)) ||
(NULL != c && connection_is_origin (c, fwd)) )
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n");
if (0 < buffer)
{
GNUNET_assert (NULL != ch);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " really sending!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " really sending!\n");
send_local_ack (ch, fwd);
}
}
else if (NULL == c)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending on all connections\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on all connections\n");
GNUNET_assert (NULL != ch);
channel_send_connections_ack (ch, buffer, fwd);
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending on connection\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on connection\n");
connection_send_ack (c, buffer, fwd);
}
}
@@ -1755,7 +1753,7 @@
GNUNET_CONFIGURATION_get_value_number (c, "MESH", "MAX_MSGS_QUEUE",
&max_msgs_queue))
{
- GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ LOG_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"MESH", "MAX_MSGS_QUEUE", "MISSING");
GNUNET_SCHEDULER_shutdown ();
return;
@@ -1765,7 +1763,7 @@
GNUNET_CONFIGURATION_get_value_number (c, "MESH", "MAX_CONNECTIONS",
&max_connections))
{
- GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ LOG_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"MESH", "MAX_CONNECTIONS", "MISSING");
GNUNET_SCHEDULER_shutdown ();
return;
@@ -1775,7 +1773,7 @@
GNUNET_CONFIGURATION_get_value_time (c, "MESH",
"REFRESH_CONNECTION_TIME",
&refresh_connection_time))
{
- GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ LOG_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"MESH", "REFRESH_CONNECTION_TIME", "MISSING");
GNUNET_SCHEDULER_shutdown ();
return;
@@ -1823,7 +1821,7 @@
if (NULL == c)
return;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "destroying connection %s[%X]\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying connection %s[%X]\n",
peer2s (c->t->peer),
c->id);
@@ -1965,7 +1963,7 @@
data = GNUNET_malloc (size);
memcpy (data, message, size);
type = ntohs (message->type);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send %s (%u) on connection %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Send %s (%u) on connection %s\n",
GNUNET_MESH_DEBUG_M2S (type), size, GNUNET_h2s (&c->id));
switch (type)
@@ -1989,20 +1987,20 @@
emsg->cid = c->id;
emsg->ttl = htonl (ttl - 1);
emsg->pid = htonl (fwd ? c->fwd_fc.next_pid++ : c->bck_fc.next_pid++);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " pid %u\n", ntohl (emsg->pid));
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " pid %u\n", ntohl (emsg->pid));
break;
case GNUNET_MESSAGE_TYPE_MESH_ACK:
amsg = (struct GNUNET_MESH_ACK *) data;
amsg->cid = c->id;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", ntohl (amsg->ack));
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", ntohl (amsg->ack));
break;
case GNUNET_MESSAGE_TYPE_MESH_POLL:
pmsg = (struct GNUNET_MESH_Poll *) data;
pmsg->cid = c->id;
pmsg->pid = htonl (fwd ? c->fwd_fc.last_pid_sent :
c->bck_fc.last_pid_sent);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " poll %u\n", ntohl (pmsg->pid));
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " poll %u\n", ntohl (pmsg->pid));
break;
case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY:
Modified: gnunet/src/mesh/gnunet-service-mesh_dht.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_dht.c 2013-10-08 11:12:41 UTC (rev
29979)
+++ gnunet/src/mesh/gnunet-service-mesh_dht.c 2013-10-08 11:15:01 UTC (rev
29980)
@@ -28,14 +28,6 @@
#include "gnunet-service-mesh_dht.h"
#include "gnunet-service-mesh_peer.h"
-#define MESH_DEBUG_DHT GNUNET_NO
-
-#if MESH_DEBUG_DHT
-#define DEBUG_DHT(...) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
-#else
-#define DEBUG_DHT(...)
-#endif
-
#define LOG (level, ...) GNUNET_log_from ("mesh-dht", level, __VA_ARGS__)
@@ -124,18 +116,18 @@
p->peers[0] = myid;
GNUNET_PEER_change_rc (myid, 1);
i = get_path_length;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " GET has %d hops.\n", i);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " GET has %d hops.\n", i);
for (i--; i >= 0; i--)
{
id = GNUNET_PEER_intern (&get_path[i]);
if (p->length > 0 && id == p->peers[p->length - 1])
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Optimizing 1 hop out.\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Optimizing 1 hop out.\n");
GNUNET_PEER_change_rc (id, -1);
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Adding from GET: %s.\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Adding from GET: %s.\n",
GNUNET_i2s (&get_path[i]));
p->length++;
p->peers = GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) *
p->length);
@@ -143,7 +135,7 @@
}
}
i = put_path_length;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " PUT has %d hops.\n", i);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " PUT has %d hops.\n", i);
for (i--; i >= 0; i--)
{
id = GNUNET_PEER_intern (&put_path[i]);
@@ -157,12 +149,12 @@
}
if (p->length > 0 && id == p->peers[p->length - 1])
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Optimizing 1 hop out.\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Optimizing 1 hop out.\n");
GNUNET_PEER_change_rc (id, -1);
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Adding from PUT: %s.\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " Adding from PUT: %s.\n",
GNUNET_i2s (&put_path[i]));
p->length++;
p->peers = GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) *
p->length);
@@ -171,19 +163,19 @@
}
#if MESH_DEBUG
if (get_path_length > 0)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " (first of GET: %s)\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " (first of GET: %s)\n",
GNUNET_i2s (&get_path[0]));
if (put_path_length > 0)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " (first of PUT: %s)\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " (first of PUT: %s)\n",
GNUNET_i2s (&put_path[0]));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " In total: %d hops\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " 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, " %u: %s\n", p->peers[i],
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " %u: %s\n", p->peers[i],
GNUNET_i2s (&peer_id));
}
#endif
@@ -245,12 +237,11 @@
announce_id_task = GNUNET_SCHEDULER_NO_TASK;
return;
}
+
/* TODO
* - Set data expiration in function of X
* - Adapt X to churn
*/
- DEBUG_DHT ("DHT_put for ID %s started.\n", GNUNET_i2s (id));
-
block.id = *full_id;
GNUNET_CRYPTO_hash (full_id, sizeof (struct GNUNET_PeerIdentity), &phash);
GNUNET_DHT_put (dht_handle, /* DHT handle */
@@ -288,7 +279,7 @@
GNUNET_CONFIGURATION_get_value_number (c, "MESH",
"DHT_REPLICATION_LEVEL",
&dht_replication_level))
{
- GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
+ LOG_config_invalid (GNUNET_ERROR_TYPE_WARNING,
"MESH", "DHT_REPLICATION_LEVEL", "USING
DEFAULT");
dht_replication_level = 3;
}
@@ -297,7 +288,7 @@
GNUNET_CONFIGURATION_get_value_time (c, "MESH", "ID_ANNOUNCE_TIME",
&id_announce_time))
{
- GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ LOG_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"MESH", "ID_ANNOUNCE_TIME", "MISSING");
GNUNET_SCHEDULER_shutdown ();
return;
Modified: gnunet/src/mesh/gnunet-service-mesh_local.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_local.c 2013-10-08 11:12:41 UTC (rev
29979)
+++ gnunet/src/mesh/gnunet-service-mesh_local.c 2013-10-08 11:15:01 UTC (rev
29980)
@@ -26,6 +26,8 @@
#include "gnunet-service-mesh_local.h"
#include "gnunet-service-mesh_tunnel.h"
+#define LOG (level, ...) GNUNET_log_from ("mesh-loc", level, __VA_ARGS__)
+
/******************************************************************************/
/******************************** STRUCTS
**********************************/
/******************************************************************************/
@@ -139,7 +141,7 @@
if (GNUNET_YES != res)
{
GNUNET_break (0);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ LOG (GNUNET_ERROR_TYPE_WARNING,
"Port %u by client %p was not registered.\n",
key, value);
}
@@ -187,17 +189,17 @@
{
struct MeshClient *c;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "client disconnected: %p\n", client);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "client disconnected: %p\n", client);
if (client == NULL)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " (SERVER DOWN)\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " (SERVER DOWN)\n");
return;
}
c = client_get (client);
if (NULL != c)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "matching client found (%u, %p)\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "matching client found (%u, %p)\n",
c->id, c);
GNUNET_SERVER_client_drop (c->handle);
c->shutting_down = GNUNET_YES;
@@ -223,14 +225,14 @@
}
GNUNET_CONTAINER_DLL_remove (clients_head, clients_tail, c);
GNUNET_STATISTICS_update (stats, "# clients", -1, GNUNET_NO);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " client free (%p)\n", c);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " client free (%p)\n", c);
GNUNET_free (c);
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, " context NULL!\n");
+ LOG (GNUNET_ERROR_TYPE_WARNING, " context NULL!\n");
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "done!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "done!\n");
return;
}
@@ -252,7 +254,7 @@
uint32_t *p;
unsigned int i;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "new client connected %p\n", client);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "new client connected %p\n", client);
/* Check data sanity */
size = ntohs (message->size) - sizeof (struct GNUNET_MESH_ClientConnect);
@@ -267,8 +269,8 @@
/* Initialize new client structure */
c = GNUNET_SERVER_client_get_user_context (client, struct MeshClient);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " client id %u\n", c->id);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " client has %u ports\n", size);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " client id %u\n", c->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " client has %u ports\n", size);
if (size > 0)
{
uint32_t u32;
@@ -278,7 +280,7 @@
for (i = 0; i < size; i++)
{
u32 = ntohl (p[i]);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " port: %u\n", u32);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " port: %u\n", u32);
/* store in client's hashmap */
GNUNET_CONTAINER_multihashmap32_put (c->ports, u32, c,
@@ -297,7 +299,7 @@
GNUNET_STATISTICS_update (stats, "# clients", 1, GNUNET_NO);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "new client processed\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "new client processed\n");
}
@@ -319,7 +321,7 @@
struct MeshClient *c;
MESH_ChannelNumber chid;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "new channel requested\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "new channel requested\n");
/* Sanity check for client registration */
if (NULL == (c = client_get (client)))
@@ -328,7 +330,7 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
/* Message size sanity check */
if (sizeof (struct GNUNET_MESH_ChannelMessage) != ntohs (message->size))
@@ -339,7 +341,7 @@
}
msg = (struct GNUNET_MESH_ChannelMessage *) message;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n",
GNUNET_i2s (&msg->peer), ntohl (msg->port));
chid = ntohl (msg->channel_id);
@@ -383,7 +385,7 @@
ch->root_rel->ch = ch;
ch->root_rel->expected_delay = MESH_RETRANSMIT_TIME;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CREATED CHANNEL %s[%x]:%u (%x)\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "CREATED CHANNEL %s[%x]:%u (%x)\n",
peer2s (t->peer), ch->gid, ch->port, ch->lid_root);
/* Send create channel */
@@ -421,7 +423,7 @@
struct MeshTunnel2 *t;
MESH_ChannelNumber chid;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Got a DESTROY CHANNEL from client!\n");
/* Sanity check for client registration */
@@ -431,7 +433,7 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
/* Message sanity check */
if (sizeof (struct GNUNET_MESH_ChannelMessage) != ntohs (message->size))
@@ -448,7 +450,7 @@
ch = channel_get_by_local_id (c, chid);
if (NULL == ch)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, " channel %X not found\n", chid);
+ LOG (GNUNET_ERROR_TYPE_ERROR, " channel %X not found\n", chid);
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
@@ -466,7 +468,7 @@
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ LOG (GNUNET_ERROR_TYPE_ERROR,
" channel %X client %p (%p, %p)\n",
chid, c, ch->root, ch->dest);
GNUNET_break (0);
@@ -500,7 +502,7 @@
size_t size;
int fwd;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Got data from a client!\n");
/* Sanity check for client registration */
@@ -510,7 +512,7 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
msg = (struct GNUNET_MESH_LocalData *) message;
@@ -564,7 +566,7 @@
payload->header.size = htons (p2p_size);
payload->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_DATA);
payload->chid = htonl (ch->gid);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n");
send_prebuilt_message_channel (&payload->header, ch, fwd);
if (GNUNET_YES == ch->reliable)
@@ -572,7 +574,7 @@
}
if (tunnel_get_buffer (ch->t, fwd) > 0)
send_local_ack (ch, fwd);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "receive done OK\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "receive done OK\n");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
@@ -597,7 +599,7 @@
MESH_ChannelNumber chid;
int fwd;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got a local ACK\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a local ACK\n");
/* Sanity check for client registration */
if (NULL == (c = client_get (client)))
@@ -606,20 +608,20 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
msg = (struct GNUNET_MESH_LocalAck *) message;
/* Channel exists? */
chid = ntohl (msg->channel_id);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", chid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", chid);
ch = channel_get_by_local_id (c, chid);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " -- ch %p\n", ch);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " -- ch %p\n", ch);
if (NULL == ch)
{
GNUNET_break (0);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Channel %X unknown.\n", chid);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, " for client %u.\n", c->id);
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Channel %X unknown.\n", chid);
+ LOG (GNUNET_ERROR_TYPE_WARNING, " for client %u.\n", c->id);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
@@ -662,7 +664,7 @@
// msg->header.size = htons (sizeof (struct GNUNET_MESH_LocalMonitor));
// msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS);
//
-// GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+// LOG (GNUNET_ERROR_TYPE_INFO,
// "* sending info about tunnel %s\n",
// GNUNET_i2s (&msg->owner));
//
@@ -693,13 +695,13 @@
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ LOG (GNUNET_ERROR_TYPE_INFO,
"Received get tunnels request from client %u\n",
c->id);
// GNUNET_CONTAINER_multihashmap_iterate (tunnels,
// monitor_all_tunnels_iterator,
// client);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ LOG (GNUNET_ERROR_TYPE_INFO,
"Get tunnels request from client %u completed\n",
c->id);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -731,7 +733,7 @@
}
msg = (struct GNUNET_MESH_LocalMonitor *) message;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ LOG (GNUNET_ERROR_TYPE_INFO,
"Received tunnel info request from client %u for tunnel
%s[%X]\n",
c->id,
&msg->owner,
@@ -759,7 +761,7 @@
&resp->header, GNUNET_NO);
GNUNET_free (resp);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ LOG (GNUNET_ERROR_TYPE_INFO,
"Monitor tunnel request from client %u completed\n",
c->id);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -868,14 +870,14 @@
res = GNUNET_CONTAINER_multihashmap32_remove (c->own_channels,
ch->lid_root, ch);
if (GNUNET_YES != res)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "client_delete_channel owner KO\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "client_delete_channel owner KO\n");
}
if (c == ch->dest)
{
res = GNUNET_CONTAINER_multihashmap32_remove (c->incoming_channels,
ch->lid_dest, ch);
if (GNUNET_YES != res)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "client_delete_tunnel client KO\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "client_delete_tunnel client KO\n");
}
}
@@ -903,7 +905,7 @@
rel->client_ready = GNUNET_YES;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"send local %s ack on %s:%X towards %p\n",
fwd ? "FWD" : "BCK", peer2s (ch->t->peer), ch->gid, c);
Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c 2013-10-08 11:12:41 UTC (rev
29979)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c 2013-10-08 11:15:01 UTC (rev
29980)
@@ -32,6 +32,8 @@
#include "gnunet-service-mesh_local.h"
#include "mesh_path.h"
+#define LOG (level, ...) GNUNET_log_from ("mesh-p2p", level, __VA_ARGS__)
+
/******************************************************************************/
/******************************** STRUCTS
**********************************/
/******************************************************************************/
Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2013-10-08 11:12:41 UTC
(rev 29979)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2013-10-08 11:15:01 UTC
(rev 29980)
@@ -28,6 +28,7 @@
#include "gnunet-service-mesh_channel.h"
#include "mesh_path.h"
+#define LOG (level, ...) GNUNET_log_from ("mesh-tun", level, __VA_ARGS__)
/**
* All the states a tunnel can be in.
@@ -251,13 +252,13 @@
struct MeshFlowControl *fc;
unsigned int lowest_q;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tunnel_get_connection %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "tunnel_get_connection %s\n",
peer2s (t->peer));
best = NULL;
lowest_q = UINT_MAX;
for (c = t->connection_head; NULL != c; c = c->next)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " connection %s: %u\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " connection %s: %u\n",
GNUNET_h2s (&c->id), c->state);
if (MESH_CONNECTION_READY == c->state)
{
@@ -267,7 +268,7 @@
GNUNET_break (0);
continue;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " q_n %u, \n", fc->queue_n);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " q_n %u, \n", fc->queue_n);
if (fc->queue_n < lowest_q)
{
best = c;
@@ -346,11 +347,11 @@
struct MeshTunnelQueue *next;
unsigned int room;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"tunnel_send_queued_data on tunnel %s\n",
peer2s (t->peer));
room = tunnel_get_buffer (t, fwd);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " buffer space: %u\n", room);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer space: %u\n", room);
for (tq = t->tq_head; NULL != tq && room > 0; tq = next)
{
next = tq->next;
@@ -413,7 +414,7 @@
GNUNET_CONFIGURATION_get_value_number (c, "MESH", "DEFAULT_TTL",
&default_ttl))
{
- GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
+ LOG_config_invalid (GNUNET_ERROR_TYPE_WARNING,
"MESH", "DEFAULT_TTL", "USING DEFAULT");
default_ttl = 64;
}
@@ -483,11 +484,11 @@
{
if (NULL == t)
return;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Tunnel %s state was %s\n",
peer2s (t->peer),
GNUNET_MESH_DEBUG_TS2S (t->state));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Tunnel %s state is now %s\n",
peer2s (t->peer),
GNUNET_MESH_DEBUG_TS2S (state));
@@ -576,7 +577,7 @@
if (NULL == t)
return;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "destroying tunnel %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying tunnel %s\n",
peer2s (t->peer));
// if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (tunnels, &t->id,
t))
@@ -637,7 +638,7 @@
break;
default:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"end-to-end message not known (%u)\n",
ntohs (msgh->type));
}
@@ -827,7 +828,7 @@
struct MeshConnection *c;
uint16_t type;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send on Tunnel %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Send on Tunnel %s\n",
peer2s (t->peer));
c = tunnel_get_connection (t, fwd);
if (NULL == c)
@@ -846,7 +847,7 @@
msg->ttl = htonl (default_ttl);
break;
default:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "unkown type %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "unkown type %s\n",
GNUNET_MESH_DEBUG_M2S (type));
GNUNET_break (0);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29980 - gnunet/src/mesh,
gnunet <=