Fix perf_crypto_rsa.c after various changes
[oweals/gnunet.git] / src / util / service.c
index fc7c4120f87b9cc7aab2af668e4405e1bc71b2d1..bdef1736143a76885784f32597329d187bef706f 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2009, 2012 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2009, 2012 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
@@ -187,7 +187,7 @@ struct GNUNET_SERVICE_Context
   /**
    * Task ID of the shutdown task.
    */
-  struct GNUNET_SCHEDULER_Task * shutdown_task;
+  struct GNUNET_SCHEDULER_Task *shutdown_task;
 
   /**
    * Idle timeout for server.
@@ -1126,11 +1126,9 @@ write_pid_file (struct GNUNET_SERVICE_Context *sctx, pid_t pid)
  * Task run during shutdown.  Stops the server/service.
  *
  * @param cls the `struct GNUNET_SERVICE_Context`
- * @param tc unused
  */
 static void
-shutdown_task (void *cls,
-               const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
 {
   struct GNUNET_SERVICE_Context *service = cls;
   struct GNUNET_SERVER_Handle *server = service->server;
@@ -1147,16 +1145,13 @@ shutdown_task (void *cls,
  * Initial task for the service.
  *
  * @param cls service context
- * @param tc unused
  */
 static void
-service_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+service_task (void *cls)
 {
   struct GNUNET_SERVICE_Context *sctx = cls;
   unsigned int i;
 
-  if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
-    return;
   (void) GNUNET_SPEEDUP_start_ (sctx->cfg);
   GNUNET_RESOLVER_connect (sctx->cfg);
   if (NULL != sctx->lsocks)
@@ -1192,9 +1187,8 @@ service_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   {
     /* install a task that will kill the server
      * process if the scheduler ever gets a shutdown signal */
-    sctx->shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
-                                                        &shutdown_task,
-                                                       sctx);
+    sctx->shutdown_task = GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+                                                        sctx);
   }
   sctx->my_handlers = GNUNET_malloc (sizeof (defhandlers));
   memcpy (sctx->my_handlers, defhandlers, sizeof (defhandlers));
@@ -1428,9 +1422,9 @@ GNUNET_SERVICE_run (int argc, char *const *argv,
                      "%s%s%s",
                      xdg,
                      DIR_SEPARATOR_STR,
-                     "gnunet.conf");
+                     GNUNET_OS_project_data_get ()->config_file);
   else
-    cfg_fn = GNUNET_strdup (GNUNET_DEFAULT_USER_CONFIG_FILE);
+    cfg_fn = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file);
   memset (&sctx, 0, sizeof (sctx));
   sctx.options = options;
   sctx.ready_confirm_fd = -1;