From 62c6348d94c8571e98df3c86928dd47fe84bb002 Mon Sep 17 00:00:00 2001
From: ulfvonbelow <strilen@tilde.club>
Date: Sun, 29 Jan 2023 05:47:00 -0600
Subject: [PATCH] REVOCATION: add shutdown task earlier.

There are many things that can go wrong and require cleanup before the
shutdown task is currently added. In these cases, GNUNET_SCHEDULER_shutdown is
run and run() is returned from. At present, the only harm in running
shutdown_task earlier would be it unconditionally destroying revocation_map,
so we can add it as soon as that exists.
---
 src/revocation/gnunet-service-revocation.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index e10771557..2cee70857 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -899,6 +899,8 @@ run (void *cls,
   cfg = c;
   revocation_map = GNUNET_CONTAINER_multihashmap_create (16,
                                                          GNUNET_NO);
+  GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+                                 NULL);
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_number (cfg,
                                              "REVOCATION",
@@ -1001,8 +1003,6 @@ run (void *cls,
   }
   GNUNET_free (fn);
 
-  GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
-                                 NULL);
   peers = GNUNET_CONTAINER_multipeermap_create (128,
                                                 GNUNET_YES);
   /* Connect to core service and register core handlers */
-- 
2.38.1

