aboutsummaryrefslogtreecommitdiff
path: root/src/gnsrecord
diff options
context:
space:
mode:
authorAlessio Vanni <vannilla@firemail.cc>2021-04-04 16:51:09 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2021-04-05 18:15:14 +0200
commit45720bde1c56c414fec8a1c3d5775208c3b32139 (patch)
tree74dc74c8d1639c50901320b688bb3cae81d47266 /src/gnsrecord
parent879cfdc43babb80a0c0618dfe3afa960fbed6e7d (diff)
downloadgnunet-45720bde1c56c414fec8a1c3d5775208c3b32139.tar.gz
gnunet-45720bde1c56c414fec8a1c3d5775208c3b32139.zip
Implement function to load plugins within a specific context
When `GNUNET_OS_init' is called to change the application project data, lazy-loading plugins will fail as it will not find the requested files. The function will temporarily swap the project data with the argument value and will search for plugins, within the installation directory tree inferred from that structure. Applications can still use `GNUNET_PLUGIN_load_all' to load their plugins from within their own installation directory tree, though services are recommended to use the `in_context' version to avoid falling in the same pit. Signed-off-by: Martin Schanzenbach <mschanzenbach@posteo.de>
Diffstat (limited to 'src/gnsrecord')
-rw-r--r--src/gnsrecord/gnsrecord.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/gnsrecord/gnsrecord.c b/src/gnsrecord/gnsrecord.c
index 8d5a6d95b..31749a629 100644
--- a/src/gnsrecord/gnsrecord.c
+++ b/src/gnsrecord/gnsrecord.c
@@ -102,15 +102,12 @@ init ()
102 if (1 == once) 102 if (1 == once)
103 return; 103 return;
104 once = 1; 104 once = 1;
105 const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
106 const struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default ();
107 105
108 if (pd != dpd) 106 GNUNET_PLUGIN_load_all_in_context (GNUNET_OS_project_data_default (),
109 GNUNET_OS_init (dpd); 107 "libgnunet_plugin_gnsrecord_",
110 GNUNET_PLUGIN_load_all ("libgnunet_plugin_gnsrecord_", NULL, 108 NULL,
111 &add_plugin, NULL); 109 &add_plugin,
112 if (pd != dpd) 110 NULL);
113 GNUNET_OS_init (pd);
114} 111}
115 112
116 113