summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7f8971d)
raw | patch | inline | side by side (parent: 7f8971d)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 1 Feb 2015 10:31:23 +0000 (11:31 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 1 Feb 2015 14:00:37 +0000 (15:00 +0100) |
This will destruct all registered user-data objects, thus properly shutting
down all internal plugin state (e.g. connections to other systems).
down all internal plugin state (e.g. connections to other systems).
src/core/plugin.c | patch | blob | history | |
src/include/core/plugin.h | patch | blob | history | |
src/tools/sysdbd/main.c | patch | blob | history |
diff --git a/src/core/plugin.c b/src/core/plugin.c
index da77f8e57a637426894a1a425498b0216cd8ff7c..bf0bdb34a20af428c73ab63250c7b0f4d3f4c00b 100644 (file)
--- a/src/core/plugin.c
+++ b/src/core/plugin.c
/* else: other callbacks still reference it */
} /* plugin_unregister_by_name */
-static void
-plugin_unregister_all(void)
-{
- size_t i;
-
- for (i = 0; i < SDB_STATIC_ARRAY_LEN(all_lists); ++i) {
- const char *type = all_lists[i].type;
- sdb_llist_t *list = *all_lists[i].list;
-
- size_t len = sdb_llist_len(list);
-
- if (! len)
- continue;
-
- sdb_llist_clear(list);
- sdb_log(SDB_LOG_INFO, "core: Unregistered %zu %s callback%s",
- len, type, len == 1 ? "" : "s");
- }
-} /* plugin_unregister_all */
-
/*
* private types
*/
return 0;
} /* sdb_store_register_writer */
+void
+sdb_plugin_unregister_all(void)
+{
+ size_t i;
+
+ for (i = 0; i < SDB_STATIC_ARRAY_LEN(all_lists); ++i) {
+ const char *type = all_lists[i].type;
+ sdb_llist_t *list = *all_lists[i].list;
+
+ size_t len = sdb_llist_len(list);
+
+ if (! len)
+ continue;
+
+ sdb_llist_clear(list);
+ sdb_log(SDB_LOG_INFO, "core: Unregistered %zu %s callback%s",
+ len, type, len == 1 ? "" : "s");
+ }
+} /* sdb_plugin_unregister_all */
+
sdb_plugin_ctx_t
sdb_plugin_get_ctx(void)
{
CTX(sdb_llist_iter_get_next(iter))->use_cnt = 0;
sdb_llist_iter_destroy(iter);
- plugin_unregister_all();
+ sdb_plugin_unregister_all();
return 0;
} /* sdb_plugin_reconfigure_init */
index f48980aa4820326d298e12da642e0454c942fb19..1155a957cd3f06fc186b16d4250662c25aaaa9dd 100644 (file)
sdb_plugin_register_writer(const char *name,
sdb_store_writer_t *writer, sdb_object_t *user_data);
+/*
+ * sdb_plugin_unregister_all:
+ * Unregister all registered plugins and destruct their user-data objects.
+ */
+void
+sdb_plugin_unregister_all(void);
+
/*
* sdb_plugin_get_ctx, sdb_plugin_set_ctx:
* The plugin context defines a set of settings that are available whenever a
index 3e90439f0a8d1f46cf7db892d6d5e4c31ee735e3..25f6499feecc4817903a4ccf13105c43d81ad08c 100644 (file)
--- a/src/tools/sysdbd/main.c
+++ b/src/tools/sysdbd/main.c
sdb_log(SDB_LOG_INFO, "Shutting down SysDB daemon "SDB_VERSION_STRING
SDB_VERSION_EXTRA" (pid %i)", (int)getpid());
sdb_plugin_shutdown_all();
+ sdb_plugin_unregister_all();
ERR_free_strings();
return status;