[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33944 - gnunet/src/cadet
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33944 - gnunet/src/cadet |
Date: |
Wed, 9 Jul 2014 16:07:12 +0200 |
Author: bartpolot
Date: 2014-07-09 16:07:12 +0200 (Wed, 09 Jul 2014)
New Revision: 33944
Modified:
gnunet/src/cadet/gnunet-service-cadet_connection.c
gnunet/src/cadet/gnunet-service-cadet_connection.h
gnunet/src/cadet/gnunet-service-cadet_peer.c
gnunet/src/cadet/gnunet-service-cadet_tunnel.c
Log:
- fix variable log level, add connection debug function
Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c 2014-07-09 14:07:11 UTC
(rev 33943)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c 2014-07-09 14:07:12 UTC
(rev 33944)
@@ -38,7 +38,9 @@
#define LOG(level, ...) GNUNET_log_from (level,"cadet-con",__VA_ARGS__)
+#define LOG2(level, ...) GNUNET_log_from_nocheck(level,"cadet-con",__VA_ARGS__)
+
#define CADET_MAX_POLL_TIME GNUNET_TIME_relative_multiply (\
GNUNET_TIME_UNIT_MINUTES,\
10)
@@ -1854,7 +1856,6 @@
}
return GNUNET_OK;
-
}
@@ -3186,3 +3187,53 @@
}
return GNUNET_h2s (GC_h2hc (&c->id));
}
+
+
+/**
+ * Log all possible info about the connection state.
+ *
+ * @param c Connection to debug.
+ * @param level Debug level to use.
+ */
+void
+GCC_debug (const struct CadetConnection *c, enum GNUNET_ErrorType level)
+{
+ int do_log;
+ char *s;
+
+ do_log = GNUNET_get_log_call_status (level & (~GNUNET_ERROR_TYPE_BULK),
+ "cadet-con",
+ __FILE__, __FUNCTION__, __LINE__);
+ if (0 == do_log)
+ return;
+
+ LOG2 (level, "CCC DEBUG CONNECTION %s\n", GCC_2s (c));
+ s = path_2s (c->path);
+ LOG2 (level, "CCC path %s, own pos: %u\n", s, c->own_pos);
+ GNUNET_free (s);
+ LOG2 (level, "CCC state: %s, destroy: %u\n",
+ GCC_state2s (c->state), c->destroy);
+ LOG2 (level, "CCC pending messages: %u\n", c->pending_messages);
+ LOG2 (level, "CCC us/byte: %f\n", c->perf->avg);
+
+ LOG2 (level, "CCC FWD flow control:\n");
+ LOG2 (level, "CCC queue: %u/%u\n", c->fwd_fc.queue_n, c->fwd_fc.queue_max);
+ LOG2 (level, "CCC last PID sent: %5u, recv: %5u\n",
+ c->fwd_fc.last_pid_sent, c->fwd_fc.last_pid_recv);
+ LOG2 (level, "CCC last ACK sent: %5u, recv: %5u\n",
+ c->fwd_fc.last_ack_sent, c->fwd_fc.last_ack_recv);
+ LOG2 (level, "CCC POLL: task %d, msg %p, msg_ack %p)\n",
+ c->fwd_fc.poll_task, c->fwd_fc.poll_msg, c->fwd_fc.ack_msg);
+
+ LOG2 (level, "CCC BCK flow control:\n");
+ LOG2 (level, "CCC queue: %u/%u\n", c->bck_fc.queue_n, c->bck_fc.queue_max);
+ LOG2 (level, "CCC last PID sent: %5u, recv: %5u\n",
+ c->bck_fc.last_pid_sent, c->bck_fc.last_pid_recv);
+ LOG2 (level, "CCC last ACK sent: %5u, recv: %5u\n",
+ c->bck_fc.last_ack_sent, c->bck_fc.last_ack_recv);
+ LOG2 (level, "CCC POLL: task %d, msg %p, msg_ack %p)\n",
+ c->bck_fc.poll_task, c->bck_fc.poll_msg, c->bck_fc.ack_msg);
+
+ LOG2 (level, "CCC DEBUG CONNECTION END\n");
+}
+
Modified: gnunet/src/cadet/gnunet-service-cadet_connection.h
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.h 2014-07-09 14:07:11 UTC
(rev 33943)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.h 2014-07-09 14:07:12 UTC
(rev 33944)
@@ -554,6 +554,15 @@
const char *
GCC_2s (const struct CadetConnection *c);
+/**
+ * Log all possible info about the connection state.
+ *
+ * @param c Connection to debug.
+ * @param level Debug level to use.
+ */
+void
+GCC_debug (const struct CadetConnection *c, enum GNUNET_ErrorType level);
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
Modified: gnunet/src/cadet/gnunet-service-cadet_peer.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_peer.c 2014-07-09 14:07:11 UTC
(rev 33943)
+++ gnunet/src/cadet/gnunet-service-cadet_peer.c 2014-07-09 14:07:12 UTC
(rev 33944)
@@ -35,7 +35,9 @@
#include "cadet_path.h"
#define LOG(level, ...) GNUNET_log_from (level,"cadet-p2p",__VA_ARGS__)
+#define LOG2(level, ...) GNUNET_log_from_nocheck(level,"cadet-p2p",__VA_ARGS__)
+
/******************************************************************************/
/******************************** STRUCTS
**********************************/
/******************************************************************************/
@@ -229,26 +231,36 @@
/**
* Log all kinds of info about the queueing status of a peer.
+ *
+ * @param p Peer whose queue to show.
+ * @param level Error level to use for logging.
*/
static void
queue_debug (const struct CadetPeer *p, enum GNUNET_ErrorType level)
{
struct CadetPeerQueue *q;
+ int do_log;
- LOG (level, "QQQ Message queue towards %s\n", GCP_2s (p));
- LOG (level, "QQQ queue length: %u\n", p->queue_n);
- LOG (level, "QQQ core tmt rdy: %p\n", p->core_transmit);
+ do_log = GNUNET_get_log_call_status (level & (~GNUNET_ERROR_TYPE_BULK),
+ "cadet-p2p",
+ __FILE__, __FUNCTION__, __LINE__);
+ if (0 == do_log)
+ return;
+ LOG2 (level, "QQQ Message queue towards %s\n", GCP_2s (p));
+ LOG2 (level, "QQQ queue length: %u\n", p->queue_n);
+ LOG2 (level, "QQQ core tmt rdy: %p\n", p->core_transmit);
+
for (q = p->queue_head; NULL != q; q = q->next)
{
- LOG (level, "QQQ - %s %s on %s\n",
+ LOG2 (level, "QQQ - %s %s on %s\n",
GC_m2s (q->type), GC_f2s (q->fwd), GCC_2s (q->c));
- LOG (level, "QQQ payload %s, %u\n",
+ LOG2 (level, "QQQ payload %s, %u\n",
GC_m2s (q->payload_type), q->payload_id);
- LOG (level, "QQQ size: %u bytes\n", q->size);
+ LOG2 (level, "QQQ size: %u bytes\n", q->size);
}
- LOG (level, "QQQ End queue towards %s\n", GCP_2s (p));
+ LOG2 (level, "QQQ End queue towards %s\n", GCP_2s (p));
}
@@ -262,34 +274,41 @@
{
struct CadetPeerPath *path;
unsigned int conns;
+ int do_log;
+ do_log = GNUNET_get_log_call_status (level & (~GNUNET_ERROR_TYPE_BULK),
+ "cadet-p2p",
+ __FILE__, __FUNCTION__, __LINE__);
+ if (0 == do_log)
+ return;
+
if (NULL == p)
{
- LOG (level, "PPP DEBUG PEER NULL\n");
+ LOG2 (level, "PPP DEBUG PEER NULL\n");
return;
}
- LOG (level, "PPP DEBUG PEER %s\n", GCP_2s (p));
- LOG (level, "PPP last contact %s\n",
+ LOG2 (level, "PPP DEBUG PEER %s\n", GCP_2s (p));
+ LOG2 (level, "PPP last contact %s\n",
GNUNET_STRINGS_absolute_time_to_string (p->last_contact));
for (path = p->path_head; NULL != path; path = path->next)
{
char *s;
s = path_2s (path);
- LOG (level, "PPP path: %s\n", s);
+ LOG2 (level, "PPP path: %s\n", s);
GNUNET_free (s);
}
- LOG (level, "PPP core transmit handle %p\n", p->core_transmit);
- LOG (level, "PPP DHT GET handle %p\n", p->search_h);
+ LOG2 (level, "PPP core transmit handle %p\n", p->core_transmit);
+ LOG2 (level, "PPP DHT GET handle %p\n", p->search_h);
if (NULL != p->connections)
conns = GNUNET_CONTAINER_multihashmap_size (p->connections);
else
conns = 0;
- LOG (level, "PPP # connections over link to peer: %u\n", conns);
+ LOG2 (level, "PPP # connections over link to peer: %u\n", conns);
queue_debug (p, level);
- LOG (level, "PPP DEBUG END\n");
+ LOG2 (level, "PPP DEBUG END\n");
}
Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c 2014-07-09 14:07:11 UTC
(rev 33943)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c 2014-07-09 14:07:12 UTC
(rev 33944)
@@ -33,6 +33,7 @@
#include "gnunet-service-cadet_peer.h"
#define LOG(level, ...) GNUNET_log_from(level,"cadet-tun",__VA_ARGS__)
+#define LOG2(level, ...) GNUNET_log_from_nocheck(level,"cadet-tun",__VA_ARGS__)
#define REKEY_WAIT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
@@ -3150,32 +3151,34 @@
{
struct CadetTChannel *iterch;
struct CadetTConnection *iterc;
+ int do_log;
- LOG (level, "TTT DEBUG TUNNEL TOWARDS %s\n", GCT_2s (t));
- LOG (level, "TTT cstate %s, estate %s\n",
+ do_log = GNUNET_get_log_call_status (level & (~GNUNET_ERROR_TYPE_BULK),
+ "cadet-tun",
+ __FILE__, __FUNCTION__, __LINE__);
+ if (0 == do_log)
+ return;
+
+ LOG2 (level, "TTT DEBUG TUNNEL TOWARDS %s\n", GCT_2s (t));
+ LOG2 (level, "TTT cstate %s, estate %s\n",
cstate2s (t->cstate), estate2s (t->estate));
- LOG (level, "TTT kx_ctx %p, rekey_task %u\n", t->kx_ctx, t->rekey_task);
- LOG (level, "TTT tq_head %p, tq_tail %p\n", t->tq_head, t->tq_tail);
- LOG (level, "TTT destroy %u\n", t->destroy_task);
+ LOG2 (level, "TTT kx_ctx %p, rekey_task %u\n", t->kx_ctx, t->rekey_task);
+ LOG2 (level, "TTT tq_head %p, tq_tail %p\n", t->tq_head, t->tq_tail);
+ LOG2 (level, "TTT destroy %u\n", t->destroy_task);
- LOG (level, "TTT channels:\n");
+ LOG2 (level, "TTT channels:\n");
for (iterch = t->channel_head; NULL != iterch; iterch = iterch->next)
{
- LOG (level, "TTT - %s\n", GCCH_2s (iterch->ch));
+ LOG2 (level, "TTT - %s\n", GCCH_2s (iterch->ch));
}
- LOG (level, "TTT connections:\n");
+ LOG2 (level, "TTT connections:\n");
for (iterc = t->connection_head; NULL != iterc; iterc = iterc->next)
{
- LOG (level, "TTT - %s [%u] buf: %u/%u (qn %u/%u)\n",
- GCC_2s (iterc->c), GCC_get_state (iterc->c),
- GCC_get_buffer (iterc->c, GNUNET_YES),
- GCC_get_buffer (iterc->c, GNUNET_NO),
- GCC_get_qn (iterc->c, GNUNET_YES),
- GCC_get_qn (iterc->c, GNUNET_NO));
+ GCC_debug (iterc->c, level);
}
- LOG (level, "TTT DEBUG TUNNEL END\n");
+ LOG2 (level, "TTT DEBUG TUNNEL END\n");
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33944 - gnunet/src/cadet,
gnunet <=