-recover lost service_main from SVN 37845
authorChristian Grothoff <christian@grothoff.org>
Tue, 30 Aug 2016 11:02:34 +0000 (11:02 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 30 Aug 2016 11:02:34 +0000 (11:02 +0000)
src/util/service_new.c

index 773e09c5f749ae176f0d75f20aa0468683532c94..9608fbf22f87801f9e2335a50919d42b0ea1b2a1 100644 (file)
@@ -317,7 +317,7 @@ have_non_monitor_clients (struct GNUNET_SERVICE_Handle *sh)
  * @param cls our `struct GNUNET_SERVICE_Handle`
  */
 static void
-service_main (void *cls)
+service_shutdown (void *cls)
 {
   struct GNUNET_SERVICE_Handle *sh = cls;
   struct GNUNET_SERVICE_Client *client;
@@ -343,6 +343,28 @@ service_main (void *cls)
 }
 
 
+/**
+ * First task run by any service.  Initializes our shutdown task,
+ * starts the listening operation on our listen sockets and launches
+ * the custom logic of the application service.
+ *
+ * @param cls our `struct GNUNET_SERVICE_Handle`
+ */
+static void
+service_main (void *cls)
+{
+  struct GNUNET_SERVICE_Handle *sh = cls;
+
+  if (GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN != sh->options)
+    GNUNET_SCHEDULER_add_shutdown (&service_shutdown,
+                                   sh);
+  GNUNET_SERVICE_resume (sh);
+  sh->service_init_cb (sh->cb_cls,
+                       sh->cfg,
+                       sh);
+}
+
+
 /**
  * Parse an IPv4 access control list.
  *