From: Christian Grothoff Date: Mon, 29 Aug 2016 11:58:01 +0000 (+0000) Subject: -starting with service_new main logic X-Git-Tag: initial-import-from-subversion-38251~313 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=38989ef95f911d4090482bf3725e867c896d221a;p=oweals%2Fgnunet.git -starting with service_new main logic --- diff --git a/src/util/service_new.c b/src/util/service_new.c index 68988069f..5817e9eb6 100644 --- a/src/util/service_new.c +++ b/src/util/service_new.c @@ -112,7 +112,7 @@ struct GNUNET_SERVICE_Handle /** * Message handlers to use for all clients. */ - struct GNUNET_MQ_MessageHandler *handlers; + const struct GNUNET_MQ_MessageHandler *handlers; /** * Closure for @e task. @@ -209,6 +209,20 @@ struct GNUNET_SERVICE_Client }; +static void +service_main (void *cls) +{ + struct GNUNET_SERVICE_Handle *sh = cls; + + GNUNET_SCHEDULER_add_shutdown (&service_shutdown, + sh); + GNUNET_SERVICE_resume (sh); + sh->service_init_cb (sh->cb_cls, + sh->cfg, + sh); +} + + /** * Creates the "main" function for a GNUnet service. You * should almost always use the #GNUNET_SERVICE_MAIN macro @@ -261,7 +275,12 @@ GNUNET_SERVICE_ruN_ (int argc, void *cls, const struct GNUNET_MQ_MessageHandler *handlers) { - GNUNET_break (0); // not implemented + struct GNUNET_SERVICE_Handle sh; + + // FIXME: setup (parse command line, configuration, init sh) + GNUNET_SCHEDULER_run (&service_main, + &sh); + // FIXME: cleanup return 1; }