gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 01/11: Hostlist: Task added to start reading the hostlist entri


From: gnunet
Subject: [gnunet] 01/11: Hostlist: Task added to start reading the hostlist entries only after a certain period of time has elapsed.
Date: Wed, 18 Oct 2023 15:49:30 +0200

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

t3sserakt pushed a commit to branch master
in repository gnunet.

commit 7761b424ddd2639304c548577729d11aa5bb8274
Author: t3sserakt <t3ss@posteo.de>
AuthorDate: Wed Oct 18 13:23:44 2023 +0200

    Hostlist: Task added to start reading the hostlist entries only after a 
certain period of time has elapsed.
---
 src/hostlist/gnunet-daemon-hostlist_server.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/hostlist/gnunet-daemon-hostlist_server.c 
b/src/hostlist/gnunet-daemon-hostlist_server.c
index 54db95009..1da654f8f 100644
--- a/src/hostlist/gnunet-daemon-hostlist_server.c
+++ b/src/hostlist/gnunet-daemon-hostlist_server.c
@@ -68,6 +68,12 @@ static struct GNUNET_STATISTICS_Handle *stats;
  */
 static struct GNUNET_CORE_Handle *core;
 
+/**
+ * The task to delayed start the notification process intially.
+ * We like to give transport some time to give us our hello to distribute it.
+ */
+struct GNUNET_SCHEDULER_Task *peerstore_notify_task;
+
 /**
  * Our peerstore notification context.  We use notification
  * to instantly learn about new peers as they are discovered.
@@ -605,6 +611,17 @@ prepare_daemon (struct MHD_Daemon *daemon_handle)
 }
 
 
+static void
+start_notify (void *cls)
+{
+  (void) cls;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting to process new hellos to add 
to hostlist.\n");
+  peerstore_notify =
+    GNUNET_PEERSTORE_hello_changed_notify (peerstore, GNUNET_NO, 
&process_notify, NULL);
+}
+
+
 /**
  * Start server offering our hostlist.
  *
@@ -817,7 +834,9 @@ GNUNET_HOSTLIST_server_start (const struct 
GNUNET_CONFIGURATION_Handle *c,
     hostlist_task_v4 = prepare_daemon (daemon_handle_v4);
   if (NULL != daemon_handle_v6)
     hostlist_task_v6 = prepare_daemon (daemon_handle_v6);
-  peerstore_notify = GNUNET_PEERSTORE_hello_changed_notify (peerstore, 
GNUNET_NO, &process_notify, NULL);
+  peerstore_notify_task = GNUNET_SCHEDULER_add_delayed 
(GNUNET_TIME_UNIT_MINUTES,
+                                                        start_notify,
+                                                        NULL);
   return GNUNET_OK;
 }
 
@@ -859,6 +878,10 @@ GNUNET_HOSTLIST_server_stop ()
     GNUNET_PEERSTORE_hello_changed_notify_cancel (peerstore_notify);
     peerstore_notify = NULL;
   }
+  else if (NULL != peerstore_notify_task)
+  {
+    GNUNET_SCHEDULER_cancel (peerstore_notify_task);
+  }
   if (NULL != builder)
   {
     if (NULL != builder->pitr)

-- 
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]