summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/core.c64
-rw-r--r--src/core/core.h4
-rw-r--r--src/hub.c6
-rw-r--r--src/main.c10
4 files changed, 49 insertions, 35 deletions
diff --git a/src/core/core.c b/src/core/core.c
index 7be81b2..a72122c 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -49,7 +49,7 @@
/******************************************************************************
* *
-* Paramètres : - *
+* Paramètres : cs = précise si l'appel est réalisé du côté client. *
* *
* Description : Charge les éléments de base du programme. *
* *
@@ -59,7 +59,7 @@
* *
******************************************************************************/
-bool load_all_basic_components(void)
+bool load_all_core_components(bool cs)
{
static bool result = false; /* Bilan à retourner */
char *cfgdir; /* Répertoire de configuration */
@@ -79,33 +79,37 @@ bool load_all_basic_components(void)
result &= (ensure_path_exists(cfgdir) == 0);
free(cfgdir);
- g_boxed_type_register_static("vmpa_t",
- (GBoxedCopyFunc)dup_vmpa,
- (GBoxedFreeFunc)delete_vmpa);
-
ERR_load_crypto_strings();
SSL_load_error_strings();
SSL_library_init();
- result &= init_chrysalide_dynamic_types();
+ if (result) result = init_global_works();
+
+ if (result) result = load_hard_coded_collection_definitions();
+
+ if (cs)
+ {
+ g_boxed_type_register_static("vmpa_t",
+ (GBoxedCopyFunc)dup_vmpa,
+ (GBoxedFreeFunc)delete_vmpa);
- result &= load_main_config_parameters();
+ if (result) result = load_main_config_parameters();
- result &= g_generic_config_read(get_main_configuration());
+ if (result) result = g_generic_config_read(get_main_configuration());
- result &= init_global_works();
+ explorer = g_content_explorer_new();
+ set_current_content_explorer(explorer);
- explorer = g_content_explorer_new();
- set_current_content_explorer(explorer);
+ resolver = g_content_resolver_new();
+ set_current_content_resolver(resolver);
- resolver = g_content_resolver_new();
- set_current_content_resolver(resolver);
+ if (result) result = init_segment_content_hash_table();
- result &= init_segment_content_hash_table();
+ register_arch_gtypes();
- register_arch_gtypes();
+ if (result) result = init_chrysalide_dynamic_types();
- result &= load_hard_coded_collection_definitions();
+ }
}
@@ -116,7 +120,7 @@ bool load_all_basic_components(void)
/******************************************************************************
* *
-* Paramètres : - *
+* Paramètres : cs = précise si l'appel est réalisé du côté client. *
* *
* Description : Décharge les éléments de base du programme. *
* *
@@ -126,25 +130,29 @@ bool load_all_basic_components(void)
* *
******************************************************************************/
-void unload_all_basic_components(void)
+void unload_all_core_components(bool cs)
{
- unload_collection_definitions();
+ if (cs)
+ {
+ exit_chrysalide_dynamic_types();
- unload_demanglers_definitions();
+ unload_demanglers_definitions();
- unload_processors_definitions();
+ unload_processors_definitions();
- set_current_content_explorer(NULL);
+ set_current_content_resolver(NULL);
- set_current_content_resolver(NULL);
+ set_current_content_explorer(NULL);
- exit_global_works();
+ g_generic_config_write(get_main_configuration());
- g_generic_config_write(get_main_configuration());
+ unload_main_config_parameters();
- unload_main_config_parameters();
+ }
- exit_chrysalide_dynamic_types();
+ unload_collection_definitions();
+
+ exit_global_works();
ERR_free_strings();
diff --git a/src/core/core.h b/src/core/core.h
index 627531c..0221f56 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -30,10 +30,10 @@
/* Charge les éléments de base du programme. */
-bool load_all_basic_components(void);
+bool load_all_core_components(bool);
/* Décharge les éléments de base du programme. */
-void unload_all_basic_components(void);
+void unload_all_core_components(bool);
diff --git a/src/hub.c b/src/hub.c
index b77bdb8..54b84ce 100644
--- a/src/hub.c
+++ b/src/hub.c
@@ -41,6 +41,7 @@
#include "gleak.h"
#include "analysis/db/auth.h"
#include "analysis/db/server.h"
+#include "core/core.h"
#include "core/global.h"
#include "core/logs.h"
#include "core/paths.h"
@@ -360,6 +361,9 @@ int main(int argc, char **argv)
set_log_verbosity(verbosity);
+ if (!load_all_core_components(false))
+ goto done;
+
/* Traitement des commandes */
switch (command)
@@ -387,6 +391,8 @@ int main(int argc, char **argv)
}
+ unload_all_core_components(false);
+
#ifdef TRACK_GOBJECT_LEAKS
remember_gtypes_for_leaks();
#endif
diff --git a/src/main.c b/src/main.c
index 1b50615..7d49ba6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -303,8 +303,8 @@ int main(int argc, char **argv)
set_log_verbosity(verbosity);
- if (!load_all_basic_components())
- return EXIT_FAILURE;
+ if (!load_all_core_components(true))
+ goto done;
/* Création de l'interface */
@@ -449,14 +449,14 @@ int main(int argc, char **argv)
failed_to_load_editor:
- unload_all_basic_components();
-
- done:
+ unload_all_core_components(true);
#ifdef TRACK_GOBJECT_LEAKS
dump_remaining_gtypes();
#endif
+ done:
+
return result;
}