convert fs publish to MQ
[oweals/gnunet.git] / src / dht / gnunet-service-dht.c
index 5efa9ddc6b64637eba5c65261b58c61ca4008d61..abdd77548be2ac6b4b884f2afb036cfed238ab23 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2009, 2010, 2011 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.
 */
 
 /**
@@ -56,6 +56,11 @@ struct GNUNET_BLOCK_Context *GDS_block_context;
  */
 const struct GNUNET_CONFIGURATION_Handle *GDS_cfg;
 
+/**
+ * Handle to our server.
+ */
+struct GNUNET_SERVER_Handle *GDS_server;
+
 /**
  * Our HELLO
  */
@@ -98,10 +103,9 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message)
  * Task run during shutdown.
  *
  * @param cls unused
- * @param tc unused
  */
 static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
 {
   if (NULL != ghh)
   {
@@ -141,10 +145,13 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  * @param c configuration to use
  */
 static void
-run (void *cls, struct GNUNET_SERVER_Handle *server,
+run (void *cls,
+     struct GNUNET_SERVER_Handle *server,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
   GDS_cfg = c;
+  GDS_server = server;
+  GNUNET_SERVER_suspend (server);
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_time (c, "transport", "HELLO_EXPIRATION", &hello_expiration))
   {
@@ -156,14 +163,13 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
   GDS_NSE_init ();
   GDS_DATACACHE_init ();
   GDS_HELLO_init ();
-  GDS_CLIENTS_init (server);
   if (GNUNET_OK != GDS_NEIGHBOURS_init ())
   {
-    shutdown_task (NULL, NULL);
+    shutdown_task (NULL);
     return;
   }
-  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
-                                NULL);
+  GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+                                NULL);
   GDS_transport_handle =
       GNUNET_TRANSPORT_connect (GDS_cfg, NULL, NULL, NULL, NULL, NULL);
   if (GDS_transport_handle == NULL)