gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: PQ: use exponential back-off when reconn


From: gnunet
Subject: [gnunet] branch master updated: PQ: use exponential back-off when reconnecting to the database to listen on events
Date: Mon, 09 Jan 2023 20:45:24 +0100

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

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new be0ba43d7 PQ: use exponential back-off when reconnecting to the 
database to listen on events
be0ba43d7 is described below

commit be0ba43d7a81a8e44c047b93e8c19cc30d2f983a
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Jan 9 20:45:16 2023 +0100

    PQ: use exponential back-off when reconnecting to the database to listen on 
events
---
 src/pq/pq.h       |  5 +++++
 src/pq/pq_event.c | 10 ++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/pq/pq.h b/src/pq/pq.h
index 85cfcc070..f9b59e058 100644
--- a/src/pq/pq.h
+++ b/src/pq/pq.h
@@ -89,6 +89,11 @@ struct GNUNET_PQ_Context
    */
   struct GNUNET_NETWORK_Handle *rfd;
 
+  /**
+   * How fast should we resubscribe again?
+   */
+  struct GNUNET_TIME_Relative resubscribe_backoff;
+
   /**
    * Flags controlling the connection.
    */
diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c
index b0ed6798a..6dbacf7ff 100644
--- a/src/pq/pq_event.c
+++ b/src/pq/pq_event.c
@@ -1,6 +1,6 @@
 /*
    This file is part of GNUnet
-   Copyright (C) 2021 GNUnet e.V.
+   Copyright (C) 2021, 2023 GNUnet e.V.
 
    GNUnet is free software: you can redistribute it and/or modify it
    under the terms of the GNU Affero General Public License as published
@@ -283,11 +283,17 @@ do_scheduler_notify (void *cls)
               "Resubscribing\n");
   if (NULL == db->rfd)
   {
+    db->resubscribe_backoff
+      = GNUNET_TIME_relative_max (db->resubscribe_backoff,
+                                  GNUNET_TIME_UNIT_SECONDS);
+    db->resubscribe_backoff
+      = GNUNET_TIME_STD_BACKOFF (db->resubscribe_backoff);
     db->event_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
                                                    &do_scheduler_notify,
                                                    db);
     return;
   }
+  db->resubscribe_backoff = GNUNET_TIME_UNIT_SECONDS;
   db->event_task
     = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
                                      db->rfd,
@@ -387,7 +393,7 @@ manage_subscribe (struct GNUNET_PQ_Context *db,
  * @param value the event handler
  * @return #GNUNET_OK to continue to iterate
  */
-static int
+static enum GNUNET_GenericReturnValue
 register_notify (void *cls,
                  const struct GNUNET_ShortHashCode *sh,
                  void *value)

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