aboutsummaryrefslogtreecommitdiff
path: root/src/block
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/block
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/block')
-rw-r--r--src/block/block.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/block/block.c b/src/block/block.c
index 5abe64e69..975c0f747 100644
--- a/src/block/block.c
+++ b/src/block/block.c
@@ -134,10 +134,11 @@ GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg)
134 134
135 ctx = GNUNET_new (struct GNUNET_BLOCK_Context); 135 ctx = GNUNET_new (struct GNUNET_BLOCK_Context);
136 ctx->cfg = cfg; 136 ctx->cfg = cfg;
137 GNUNET_PLUGIN_load_all ("libgnunet_plugin_block_", 137 GNUNET_PLUGIN_load_all_in_context (GNUNET_OS_project_data_default (),
138 (void *) cfg, 138 "libgnunet_plugin_block_",
139 &add_plugin, 139 (void *) cfg,
140 ctx); 140 &add_plugin,
141 ctx);
141 return ctx; 142 return ctx;
142} 143}
143 144