From ede5e3950ffad6c6b812d1f210f90cd066961cad Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Tue, 8 Oct 2013 14:06:30 +0000 Subject: - share one statistics handle across all subsystems --- src/mesh/gnunet-service-mesh-enc.c | 10 ++++------ src/mesh/gnunet-service-mesh_channel.c | 23 +++++++++++++++++++++++ src/mesh/gnunet-service-mesh_connection.c | 21 +++++++++++++++++++++ src/mesh/gnunet-service-mesh_dht.c | 6 ++++++ src/mesh/gnunet-service-mesh_local.c | 9 +++++++++ src/mesh/gnunet-service-mesh_peer.c | 6 ++++++ src/mesh/gnunet-service-mesh_tunnel.c | 17 +++++++++++------ 7 files changed, 80 insertions(+), 12 deletions(-) (limited to 'src/mesh') diff --git a/src/mesh/gnunet-service-mesh-enc.c b/src/mesh/gnunet-service-mesh-enc.c index 1767f5a1a..55b189da1 100644 --- a/src/mesh/gnunet-service-mesh-enc.c +++ b/src/mesh/gnunet-service-mesh-enc.c @@ -72,16 +72,14 @@ /*********************** GLOBAL VARIABLES ****************************/ /******************************************************************************/ -/************************** Configuration parameters **************************/ - - - -/*************************** Static global variables **************************/ +/****************************** Global variables ******************************/ /** * Handle to the statistics service. */ -static struct GNUNET_STATISTICS_Handle *stats; +struct GNUNET_STATISTICS_Handle *stats; + +/*************************** Static global variables **************************/ /** * Local peer own ID (memory efficient handle). diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c index e1c60b743..8d1ccb0b9 100644 --- a/src/mesh/gnunet-service-mesh_channel.c +++ b/src/mesh/gnunet-service-mesh_channel.c @@ -20,8 +20,13 @@ #include "platform.h" +#include "gnunet_util_lib.h" + +#include "gnunet_statistics_service.h" + #include "mesh_enc.h" #include "mesh_protocol_enc.h" + #include "gnunet-service-mesh_channel.h" #include "gnunet-service-mesh_local.h" #include "gnunet-service-mesh_tunnel.h" @@ -245,6 +250,20 @@ struct MeshChannel }; +/******************************************************************************/ +/******************************* GLOBALS ***********************************/ +/******************************************************************************/ + +/** + * Global handle to the statistics service. + */ +extern struct GNUNET_STATISTICS_Handle *stats; + + +/******************************************************************************/ +/******************************** STATIC ***********************************/ +/******************************************************************************/ + /** * We have received a message out of order, or the client is not ready. * Buffer it until we receive an ACK from the client or the missing @@ -1177,6 +1196,10 @@ send (const struct GNUNET_MessageHeader *message, } +/******************************************************************************/ +/******************************** API ***********************************/ +/******************************************************************************/ + /** * Count channels in a DLL. * diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index 0d7168e69..d30eabf5c 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c @@ -27,6 +27,8 @@ #include "platform.h" #include "gnunet_util_lib.h" +#include "gnunet_statistics_service.h" + #include "gnunet-service-mesh_connection.h" #include "gnunet-service-mesh_peer.h" #include "mesh_protocol_enc.h" @@ -68,6 +70,9 @@ enum MeshConnectionState }; +/******************************************************************************/ +/******************************** STRUCTS **********************************/ +/******************************************************************************/ /** * Struct containing info about a queued transmission to this peer @@ -248,6 +253,14 @@ struct MeshConnection int destroy; }; +/******************************************************************************/ +/******************************* GLOBALS ***********************************/ +/******************************************************************************/ + +/** + * Global handle to the statistics service. + */ +extern struct GNUNET_STATISTICS_Handle *stats; /** * Connections known, indexed by cid (MeshConnection). @@ -272,6 +285,10 @@ static unsigned long long max_msgs_queue; static struct GNUNET_TIME_Relative refresh_connection_time; +/******************************************************************************/ +/******************************** STATIC ***********************************/ +/******************************************************************************/ + #if 0 // avoid compiler warning for unused static function static void fc_debug (struct MeshFlowControl *fc) @@ -1014,6 +1031,10 @@ register_neighbors (struct MeshConnection *c) } +/******************************************************************************/ +/******************************** API ***********************************/ +/******************************************************************************/ + /** * Core handler for connection creation. * diff --git a/src/mesh/gnunet-service-mesh_dht.c b/src/mesh/gnunet-service-mesh_dht.c index e09c6b65e..3beb2da8a 100644 --- a/src/mesh/gnunet-service-mesh_dht.c +++ b/src/mesh/gnunet-service-mesh_dht.c @@ -23,6 +23,7 @@ #include "gnunet_util_lib.h" #include "gnunet_dht_service.h" +#include "gnunet_statistics_service.h" #include "mesh_path.h" #include "gnunet-service-mesh_dht.h" @@ -55,6 +56,11 @@ struct GMD_search_handle /******************************* GLOBALS ***********************************/ /******************************************************************************/ +/** + * Global handle to the statistics service. + */ +extern struct GNUNET_STATISTICS_Handle *stats; + /** * Handle to use DHT. */ diff --git a/src/mesh/gnunet-service-mesh_local.c b/src/mesh/gnunet-service-mesh_local.c index 6612915e4..9714034ba 100644 --- a/src/mesh/gnunet-service-mesh_local.c +++ b/src/mesh/gnunet-service-mesh_local.c @@ -20,6 +20,10 @@ #include "platform.h" +#include "gnunet_util_lib.h" + +#include "gnunet_statistics_service.h" + #include "mesh_enc.h" #include "mesh_protocol_enc.h" // GNUNET_MESH_Data is shared @@ -86,6 +90,11 @@ struct MeshClient /******************************* GLOBALS ***********************************/ /******************************************************************************/ +/** + * Global handle to the statistics service. + */ +extern struct GNUNET_STATISTICS_Handle *stats; + /** * Handle to server lib. */ diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c index 008ba5a51..6c8963864 100644 --- a/src/mesh/gnunet-service-mesh_peer.c +++ b/src/mesh/gnunet-service-mesh_peer.c @@ -23,6 +23,7 @@ #include "gnunet_util_lib.h" #include "gnunet_core_service.h" +#include "gnunet_statistics_service.h" #include "mesh_protocol_enc.h" @@ -105,6 +106,11 @@ struct MeshPeer /******************************* GLOBALS ***********************************/ /******************************************************************************/ +/** + * Global handle to the statistics service. + */ +extern struct GNUNET_STATISTICS_Handle *stats; + /** * Peers known, indexed by PeerIdentity (MeshPeer). */ diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 0c4e163e5..44ac78567 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c @@ -21,6 +21,8 @@ #include "platform.h" #include "gnunet_util_lib.h" +#include "gnunet_statistics_service.h" + #include "mesh_protocol_enc.h" #include "gnunet-service-mesh_tunnel.h" @@ -179,6 +181,11 @@ struct MeshTunnelQueue /******************************* GLOBALS ***********************************/ /******************************************************************************/ +/** + * Global handle to the statistics service. + */ +extern struct GNUNET_STATISTICS_Handle *stats; + /** * Default TTL for payload packets. */ @@ -204,7 +211,6 @@ const static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key; /******************************** STATIC ***********************************/ /******************************************************************************/ - /** * Get string description for tunnel state. * @@ -366,6 +372,10 @@ tunnel_send_queued_data (struct MeshTunnel2 *t, int fwd) } +/******************************************************************************/ +/******************************** API ***********************************/ +/******************************************************************************/ + /** * Cache a message to be sent once tunnel is online. * @@ -394,11 +404,6 @@ GMT_queue_data (struct MeshTunnel2 *t, } - -/******************************************************************************/ -/******************************** API ***********************************/ -/******************************************************************************/ - /** * Initialize the tunnel subsystem. * -- cgit v1.2.3