allow empty/NULL context message
[oweals/gnunet.git] / src / peerstore / gnunet-peerstore.c
index bdd045d090cbd8e3310d7dbda10a4e2b3e947849..25a4f0ff4b5b593e6c0f6ce5fb4539e9c2ae6f7f 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C)
+     Copyright (C)
 
      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.
 */
 
 /**
@@ -32,16 +32,16 @@ static int ret;
 /*
  * Handle to PEERSTORE service
  */
-struct GNUNET_PEERSTORE_Handle *peerstore_handle;
+static struct GNUNET_PEERSTORE_Handle *peerstore_handle;
+
 
 /**
  * Run on shutdown
  *
  * @param cls unused
- * @param tc scheduler context
  */
 static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
 {
   if (NULL != peerstore_handle)
   {
@@ -60,16 +60,15 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  * @param cfg configuration
  */
 static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+     char *const *args,
+     const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
-
-  peerstore_handle = NULL;
-  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
-                                NULL);
+  GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+                                NULL);
   peerstore_handle = GNUNET_PEERSTORE_connect (cfg);
   GNUNET_assert (NULL != peerstore_handle);
-
   ret = 0;
 }