gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: meson: libgnunet main loop (untested)


From: gnunet
Subject: [gnunet] branch master updated: meson: libgnunet main loop (untested)
Date: Tue, 17 Oct 2023 09:00:13 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 199338d4a meson: libgnunet main loop (untested)
199338d4a is described below

commit 199338d4a07b4abec06b8dabfd71e580ddcc484b
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Tue Oct 17 09:00:08 2023 +0200

    meson: libgnunet main loop (untested)
---
 src/include/gnunet_service_lib.h |  7 +++++++
 src/util/service.c               | 23 +++++++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/src/include/gnunet_service_lib.h b/src/include/gnunet_service_lib.h
index 6109d6e5e..49f9cd68b 100644
--- a/src/include/gnunet_service_lib.h
+++ b/src/include/gnunet_service_lib.h
@@ -402,6 +402,13 @@ GNUNET_SERVICE_register_ (
         }
 #endif
 
+/**
+ * Run the mainloop in a monolithic libgnunet.
+ * Must be called such that services are actually launched.
+ */
+void
+GNUNET_SERVICE_main (void);
+
 /**
  * Suspend accepting connections from the listen socket temporarily.
  * Resume activity using #GNUNET_SERVICE_resume.
diff --git a/src/util/service.c b/src/util/service.c
index 194251af2..baa8a3378 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -2143,6 +2143,8 @@ struct ServiceHandleList
 
   struct GNUNET_SERVICE_Handle *sh;
 };
+static struct ServiceHandleList *hll_head = NULL;
+static struct ServiceHandleList *hll_tail = NULL;
 
 int
 GNUNET_SERVICE_register_ (const char *service_name,
@@ -2153,8 +2155,6 @@ GNUNET_SERVICE_register_ (const char *service_name,
                           void *cls,
                           const struct GNUNET_MQ_MessageHandler *handlers)
 {
-  static struct ServiceHandleList *hll_head = NULL;
-  static struct ServiceHandleList *hll_tail = NULL;
   struct ServiceHandleList *hle;
   struct GNUNET_CONFIGURATION_Handle *cfg;
   struct GNUNET_SERVICE_Handle *sh = GNUNET_new (struct GNUNET_SERVICE_Handle);
@@ -2233,6 +2233,25 @@ fail:
   return err ? GNUNET_SYSERR : sh->ret;
 }
 
+static void
+launch_registered_services (void *cls)
+{
+  (void) cls;
+  struct ServiceHandleList *shl;
+
+  for (shl = hll_head; NULL != shl; shl = shl->next)
+  {
+    GNUNET_SCHEDULER_add_now (&service_main, shl->sh);
+  }
+
+  // FIXME sometime we need to cleanup the shl. Shutdown task?
+}
+
+void
+GNUNET_SERVICE_main (void)
+{
+  GNUNET_SCHEDULER_run (&launch_registered_services, NULL);
+}
 
 /**
  * Suspend accepting connections from the listen socket temporarily.

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]