gnunet

Main GNUnet Logic
Log | Files | Refs | Submodules | README | LICENSE

commit 9ba346f8c154a719576c87f2f0945dfacd080d5d
parent 702169aa561b11d3f0af2a05019673c6436acd38
Author: Bart Polot <bart@net.in.tum.de>
Date:   Tue, 24 Jun 2014 01:54:12 +0000

- add a peer debug function

Diffstat:
Msrc/cadet/gnunet-service-cadet_local.c | 3+--
Msrc/cadet/gnunet-service-cadet_peer.c | 43+++++++++++++++++++++++++++++++++++++++++++
Msrc/cadet/gnunet-service-cadet_peer.h | 8++++++++
3 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/src/cadet/gnunet-service-cadet_local.c b/src/cadet/gnunet-service-cadet_local.c @@ -630,8 +630,7 @@ show_peer_iterator (void *cls, struct CadetPeer *p = value; struct CadetTunnel *t; - LOG (GNUNET_ERROR_TYPE_ERROR, "Peer %s\n", GCP_2s (p)); - LOG (GNUNET_ERROR_TYPE_ERROR, " %u paths\n", GCP_count_paths (p)); + GCP_debug (p, GNUNET_ERROR_TYPE_ERROR); t = GCP_get_tunnel (p); if (NULL != t) diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c @@ -2224,3 +2224,46 @@ GCP_2s (const struct CadetPeer *peer) return "(NULL)"; return GNUNET_i2s (GNUNET_PEER_resolve2 (peer->id)); } + + +/** + * Log all kinds of info about a peer. + * + * @param peer Peer. + */ +void +GCP_debug (const struct CadetPeer *p, enum GNUNET_ErrorType level) +{ + struct CadetPeerPath *path; + struct CadetPeerQueue *q; + unsigned int conns; + + if (NULL == p) + { + LOG (level, "PPP DEBUG PEER NULL\n"); + return; + } + + LOG (level, "PPP DEBUG PEER %s\n", GCP_2s (p)); + for (path = p->path_head; NULL != path; path = path->next) + { + char *s; + + s = path_2s (path); + LOG (level, "PPP path: %s\n", s); + GNUNET_free (s); + } + + LOG (level, "PPP core transmit handle %p\n", p->core_transmit); + conns = GNUNET_CONTAINER_multihashmap_size (p->connections); + LOG (level, "PPP # connections over link to peer: %u\n", conns); + LOG (level, "PPP queue length: %u\n", p->queue_n); + for (q = p->queue_head; NULL != q; q = q->next) + { + LOG (level, "PPP - %s [payload %s, %u] on connection %s, %u bytes\n", + GC_m2s (q->type), GC_m2s (q->payload_type), q->payload_id, + GCC_2s (q->c), q->size); + } + LOG (level, "PPP DEBUG END\n"); + +} diff --git a/src/cadet/gnunet-service-cadet_peer.h b/src/cadet/gnunet-service-cadet_peer.h @@ -405,6 +405,14 @@ GCP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls); const char * GCP_2s (const struct CadetPeer *peer); +/** + * Log all kinds of info about a peer. + * + * @param peer Peer. + */ +void +GCP_debug (const struct CadetPeer *p, enum GNUNET_ErrorType level); + #if 0 /* keep Emacsens' auto-indent happy */ {