-rps: open channel when inserting peer in view
[oweals/gnunet.git] / src / testbed / gnunet-daemon-latency-logger.c
index 2dca73768d351fdf4e0ae39bc2bece1506c3ebc1..b2c7b1043bef5c58fc9f102347e9bda0bce084a7 100644 (file)
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      Copyright (C) 2008--2014 Christian Grothoff (and other contributing authors)
+      Copyright (C) 2008--2014 GNUnet e.V.
 
       GNUnet is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
       You should have received a copy of the GNU General Public License
       along with GNUnet; see the file COPYING.  If not, write to the
-      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-      Boston, MA 02111-1307, USA.
+      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+      Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -89,17 +89,12 @@ static struct sqlite3 *db;
 /**
  * Handle to the ATS performance subsystem
  */
-struct GNUNET_ATS_PerformanceHandle *ats;
+static struct GNUNET_ATS_PerformanceHandle *ats;
 
 /**
  * Prepared statement for inserting values into the database table
  */
-struct sqlite3_stmt *stmt_insert;
-
-/**
- * Shutdown task identifier
- */
-struct GNUNET_SCHEDULER_Task * shutdown_task;
+static struct sqlite3_stmt *stmt_insert;
 
 
 /**
@@ -131,13 +126,11 @@ free_iterator (void *cls,
  * Shutdown
  *
  * @param cls NULL
- * @param tc task context from scheduler
  * @return
  */
 static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
 {
-  shutdown_task = NULL;
   GNUNET_ATS_performance_done (ats);
   ats = NULL;
   if (NULL != stmt_insert)
@@ -299,8 +292,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   dbfile = NULL;
   ats = GNUNET_ATS_performance_init (c, &addr_info_cb, NULL);
   map = GNUNET_CONTAINER_multipeermap_create (30, GNUNET_YES);
-  shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
-                                                &do_shutdown, NULL);
+  GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
 }