From: Christian Grothoff Date: Sun, 15 Jan 2012 16:35:44 +0000 (+0000) Subject: -basic setup/tear down for statistics in mesh/vpn X-Git-Tag: initial-import-from-subversion-38251~15297 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=772ff3ec73c14c01997d5b561eef9c13fd4f5f6f;p=oweals%2Fgnunet.git -basic setup/tear down for statistics in mesh/vpn --- diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index cf72bf964..bfa600e48 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c @@ -43,6 +43,7 @@ #include "gnunet_protocols.h" #include "gnunet_applications.h" #include "gnunet_mesh_service.h" +#include "gnunet_statistics_service.h" #include "gnunet_constants.h" #include "tcpip_tun.h" #include "exit.h" @@ -242,6 +243,11 @@ static char *exit_argv[7]; */ static unsigned long long ipv6prefix; +/** + * Statistics. + */ +static struct GNUNET_STATISTICS_Handle *stats; + /** * The handle to mesh */ @@ -1878,6 +1884,11 @@ cleanup (void *cls GNUNET_UNUSED, GNUNET_CONTAINER_multihashmap_destroy (udp_services); udp_services = NULL; } + if (stats != NULL) + { + GNUNET_STATISTICS_destroy (stats, GNUNET_YES); + stats = NULL; + } for (i=0;i<5;i++) GNUNET_free_non_null (exit_argv[i]); } @@ -2072,6 +2083,7 @@ run (void *cls, char *const *args GNUNET_UNUSED, struct in6_addr v6; cfg = cfg_; + stats = GNUNET_STATISTICS_create ("exit", cfg); ipv4_exit = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "EXIT_IPV4"); ipv6_exit = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "EXIT_IPV6"); ipv4_enabled = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "ENABLE_IPV4"); diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index b1b00dd98..ba14b0664 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c @@ -46,6 +46,7 @@ #include "gnunet_protocols.h" #include "gnunet_applications.h" #include "gnunet_mesh_service.h" +#include "gnunet_statistics_service.h" #include "gnunet_constants.h" #include "tcpip_tun.h" #include "vpn.h" @@ -313,6 +314,11 @@ static struct GNUNET_CONTAINER_MultiHashMap *tunnel_map; */ static struct GNUNET_CONTAINER_Heap *tunnel_heap; +/** + * Statistics. + */ +static struct GNUNET_STATISTICS_Handle *stats; + /** * The handle to the VPN helper process "gnunet-helper-vpn". */ @@ -2119,6 +2125,11 @@ cleanup (void *cls GNUNET_UNUSED, GNUNET_SERVER_notification_context_destroy (nc); nc = NULL; } + if (stats != NULL) + { + GNUNET_STATISTICS_destroy (stats, GNUNET_YES); + stats = NULL; + } for (i=0;i<5;i++) GNUNET_free_non_null (vpn_argv[i]); } @@ -2237,6 +2248,7 @@ run (void *cls, struct in6_addr v6; cfg = cfg_; + stats = GNUNET_STATISTICS_create ("vpn", cfg); if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "vpn", "MAX_MAPPING", &max_destination_mappings))