diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-09-23 01:06:59 +0900 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-09-23 01:06:59 +0900 |
commit | 127ad07a3abaee00fb206aaf8b980f258d2933c8 (patch) | |
tree | 7618a15a9330c300946bc6c3fe6668a6626876cd /src/namestore/plugin_namestore_flat.c | |
parent | d78b7864d1754f2b2c5d3c47107808dfacc68e05 (diff) | |
download | gnunet-127ad07a3abaee00fb206aaf8b980f258d2933c8.tar.gz gnunet-127ad07a3abaee00fb206aaf8b980f258d2933c8.zip |
NAMESTORE: Use a per client database connection
Each connecting namestore client will now get a new database connection
through any of the plugins. This will allow us to properly use locking
in databases where available.
Diffstat (limited to 'src/namestore/plugin_namestore_flat.c')
-rw-r--r-- | src/namestore/plugin_namestore_flat.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/namestore/plugin_namestore_flat.c b/src/namestore/plugin_namestore_flat.c index 3576b14e0..3feac60d8 100644 --- a/src/namestore/plugin_namestore_flat.c +++ b/src/namestore/plugin_namestore_flat.c | |||
@@ -767,19 +767,16 @@ namestore_flat_zone_to_name (void *cls, | |||
767 | void * | 767 | void * |
768 | libgnunet_plugin_namestore_flat_init (void *cls) | 768 | libgnunet_plugin_namestore_flat_init (void *cls) |
769 | { | 769 | { |
770 | static struct Plugin plugin; | 770 | struct Plugin *plugin; |
771 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; | 771 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; |
772 | struct GNUNET_NAMESTORE_PluginFunctions *api; | 772 | struct GNUNET_NAMESTORE_PluginFunctions *api; |
773 | 773 | ||
774 | if (NULL != plugin.cfg) | 774 | plugin = GNUNET_new (struct Plugin); |
775 | return NULL; /* can only initialize once! */ | 775 | plugin->cfg = cfg; |
776 | memset (&plugin, | 776 | if (GNUNET_OK != database_setup (plugin)) |
777 | 0, | ||
778 | sizeof(struct Plugin)); | ||
779 | plugin.cfg = cfg; | ||
780 | if (GNUNET_OK != database_setup (&plugin)) | ||
781 | { | 777 | { |
782 | database_shutdown (&plugin); | 778 | database_shutdown (plugin); |
779 | GNUNET_free (plugin); | ||
783 | return NULL; | 780 | return NULL; |
784 | } | 781 | } |
785 | api = GNUNET_new (struct GNUNET_NAMESTORE_PluginFunctions); | 782 | api = GNUNET_new (struct GNUNET_NAMESTORE_PluginFunctions); |
@@ -808,6 +805,7 @@ libgnunet_plugin_namestore_flat_done (void *cls) | |||
808 | 805 | ||
809 | database_shutdown (plugin); | 806 | database_shutdown (plugin); |
810 | plugin->cfg = NULL; | 807 | plugin->cfg = NULL; |
808 | GNUNET_free (plugin); | ||
811 | GNUNET_free (api); | 809 | GNUNET_free (api); |
812 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 810 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
813 | "Flat file plugin is finished\n"); | 811 | "Flat file plugin is finished\n"); |