-basic setup/tear down for statistics in mesh/vpn
authorChristian Grothoff <christian@grothoff.org>
Sun, 15 Jan 2012 16:35:44 +0000 (16:35 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 15 Jan 2012 16:35:44 +0000 (16:35 +0000)
src/exit/gnunet-daemon-exit.c
src/vpn/gnunet-service-vpn.c

index cf72bf9642eeced7e49fac39e3e7e825bce202ee..bfa600e487a07f9627bb0c38fc54882d63d8b29f 100644 (file)
@@ -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");
index b1b00dd98a423820a3f28bef8f397333146ca0da..ba14b0664d8ab15548f3d750680bd764a6cbbf1c 100644 (file)
@@ -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))