aboutsummaryrefslogtreecommitdiff
path: root/src/rest
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/rest
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/rest')
-rw-r--r--src/rest/gnunet-rest-server.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c
index e6e03b16d..ecb3e2ae5 100644
--- a/src/rest/gnunet-rest-server.c
+++ b/src/rest/gnunet-rest-server.c
@@ -1229,10 +1229,11 @@ run (void *cls,
1229 return; 1229 return;
1230 } 1230 }
1231 /* Load plugins */ 1231 /* Load plugins */
1232 GNUNET_PLUGIN_load_all ("libgnunet_plugin_rest", 1232 GNUNET_PLUGIN_load_all_in_context (GNUNET_OS_project_data_default (),
1233 (void *) cfg, 1233 "libgnunet_plugin_rest",
1234 &load_plugin, 1234 (void *) cfg,
1235 NULL); 1235 &load_plugin,
1236 NULL);
1236 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); 1237 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
1237} 1238}
1238 1239