[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 12/20: -fix crashes on new DHT load/shutdown
From: |
gnunet |
Subject: |
[gnunet] 12/20: -fix crashes on new DHT load/shutdown |
Date: |
Sat, 19 Feb 2022 16:20:52 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit 7236e5f83a621ab972f9ae6eda5b9562aba3217b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jan 16 18:34:17 2022 +0100
-fix crashes on new DHT load/shutdown
---
src/dht/gnunet-service-dht.c | 30 +++++++++++++++++++++++++++---
src/dhtu/Makefile.am | 4 ++++
src/dhtu/dhtu.conf | 5 +++++
src/dhtu/plugin_dhtu_gnunet.c | 2 +-
src/util/plugin.c | 4 ++--
5 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index ae2ff6f7a..6ae56d427 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -78,6 +78,11 @@ struct GDS_Underlay
* Name of the underlay (i.e. "gnunet" or "ip").
*/
char *name;
+
+ /**
+ * Name of the library providing the underlay.
+ */
+ char *libname;
};
@@ -191,7 +196,7 @@ update_network_size_estimate (void *cls,
u->network_size_estimate = pow (2.0,
GNUNET_MAX (0.5,
logestimate));
- for (struct GDS_Underlay *p; NULL != p; p = p->next)
+ for (struct GDS_Underlay *p = u_head; NULL != p; p = p->next)
sum += p->network_size_estimate;
if (sum <= 2.0)
log_of_network_size_estimate = 0.5;
@@ -356,6 +361,19 @@ GDS_u_hold (struct GDS_Underlay *u,
static void
shutdown_task (void *cls)
{
+ struct GDS_Underlay *u;
+
+ while (NULL != (u = u_head))
+ {
+ GNUNET_PLUGIN_unload (u->libname,
+ u->dhtu);
+ GNUNET_CONTAINER_DLL_remove (u_head,
+ u_tail,
+ u);
+ GNUNET_free (u->name);
+ GNUNET_free (u->libname);
+ GNUNET_free (u);
+ }
GDS_NEIGHBOURS_done ();
GDS_DATACACHE_done ();
GDS_ROUTING_done ();
@@ -370,8 +388,11 @@ shutdown_task (void *cls)
GNUNET_YES);
GDS_stats = NULL;
}
- GNUNET_HELLO_builder_free (GDS_my_hello);
- GDS_my_hello = NULL;
+ if (NULL != GDS_my_hello)
+ {
+ GNUNET_HELLO_builder_free (GDS_my_hello);
+ GDS_my_hello = NULL;
+ }
GDS_CLIENTS_stop ();
}
@@ -403,6 +424,7 @@ load_underlay (void *cls,
section += strlen ("dhtu-");
u = GNUNET_new (struct GDS_Underlay);
u->env.cls = u;
+ u->env.cfg = GDS_cfg;
u->env.address_add_cb = &u_address_add;
u->env.address_del_cb = &u_address_del;
u->env.network_size_cb = &update_network_size_estimate;
@@ -420,6 +442,7 @@ load_underlay (void *cls,
GNUNET_free (u);
return;
}
+ u->libname = libname;
u->name = GNUNET_strdup (section);
GNUNET_CONTAINER_DLL_insert (u_head,
u_tail,
@@ -471,6 +494,7 @@ run (void *cls,
}
GNUNET_CRYPTO_eddsa_key_get_public (&GDS_my_private_key,
&GDS_my_identity.public_key);
+ GDS_my_hello = GNUNET_HELLO_builder_new (&GDS_my_identity);
GNUNET_CRYPTO_hash (&GDS_my_identity,
sizeof(struct GNUNET_PeerIdentity),
&GDS_my_identity_hash);
diff --git a/src/dhtu/Makefile.am b/src/dhtu/Makefile.am
index 0e10721cd..69b72db6e 100644
--- a/src/dhtu/Makefile.am
+++ b/src/dhtu/Makefile.am
@@ -10,6 +10,10 @@ if USE_COVERAGE
XLIBS = -lgcov
endif
+pkgcfg_DATA = \
+ dhtu.conf
+
+
plugin_LTLIBRARIES = \
libgnunet_plugin_dhtu_gnunet.la \
libgnunet_plugin_dhtu_ip.la
diff --git a/src/dhtu/dhtu.conf b/src/dhtu/dhtu.conf
new file mode 100644
index 000000000..438cd0955
--- /dev/null
+++ b/src/dhtu/dhtu.conf
@@ -0,0 +1,5 @@
+[dhtu-gnunet]
+ENABLED = YES
+
+[dhtu-ip]
+ENABLED = NO
diff --git a/src/dhtu/plugin_dhtu_gnunet.c b/src/dhtu/plugin_dhtu_gnunet.c
index 14e16470c..493fd5119 100644
--- a/src/dhtu/plugin_dhtu_gnunet.c
+++ b/src/dhtu/plugin_dhtu_gnunet.c
@@ -590,7 +590,7 @@ libgnunet_plugin_dhtu_gnunet_done (void *cls)
* @return the plugin's API
*/
void *
-libgnunet_plugin_dhtu_ip_init (void *cls)
+libgnunet_plugin_dhtu_gnunet_init (void *cls)
{
struct GNUNET_DHTU_PluginEnvironment *env = cls;
struct GNUNET_DHTU_PluginFunctions *api;
diff --git a/src/util/plugin.c b/src/util/plugin.c
index 39874a588..6ee41eec9 100644
--- a/src/util/plugin.c
+++ b/src/util/plugin.c
@@ -289,12 +289,12 @@ GNUNET_PLUGIN_unload (const char *library_name,
done = resolve_function (pos,
"done");
ret = NULL;
- if (NULL != done)
- ret = done (arg);
if (NULL == prev)
plugins = pos->next;
else
prev->next = pos->next;
+ if (NULL != done)
+ ret = done (arg);
lt_dlclose (pos->handle);
GNUNET_free (pos->name);
GNUNET_free (pos);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] 07/20: -more work on DHTU integration, (continued)
- [gnunet] 07/20: -more work on DHTU integration, gnunet, 2022/02/19
- [gnunet] 08/20: rebase, gnunet, 2022/02/19
- [gnunet] 13/20: -fix port initialization in addr, gnunet, 2022/02/19
- [gnunet] 11/20: -DHT: add gnunet-dht-hello for bootstrapping, gnunet, 2022/02/19
- [gnunet] 16/20: -got basics to work with dhtu and udp+ip underlay, gnunet, 2022/02/19
- [gnunet] 18/20: -fix merge issues, gnunet, 2022/02/19
- [gnunet] 20/20: -fix assertion, fix key initialization, gnunet, 2022/02/19
- [gnunet] 17/20: -try to make static analysis happy, gnunet, 2022/02/19
- [gnunet] 15/20: -adding logging, minor dthu bugfixes, gnunet, 2022/02/19
- [gnunet] 19/20: -fix htons/htonl bug introduced by message format change, gnunet, 2022/02/19
- [gnunet] 12/20: -fix crashes on new DHT load/shutdown,
gnunet <=
- [gnunet] 10/20: -add hold/drop logic, gnunet, 2022/02/19
- [gnunet] 06/20: -implement TVG, gnunet, 2022/02/19
- [gnunet] 05/20: add new HELLO_URI block support to block plugin, gnunet, 2022/02/19
- [gnunet] 14/20: -DHT: get tests to pass, gnunet, 2022/02/19