From: Christian Grothoff Date: Tue, 30 Aug 2016 11:02:34 +0000 (+0000) Subject: -recover lost service_main from SVN 37845 X-Git-Tag: initial-import-from-subversion-38251~303 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=dd07add29a1023330edd1ccfc4e54991082bfe86;p=oweals%2Fgnunet.git -recover lost service_main from SVN 37845 --- diff --git a/src/util/service_new.c b/src/util/service_new.c index 773e09c5f..9608fbf22 100644 --- a/src/util/service_new.c +++ b/src/util/service_new.c @@ -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. *