split initialization from configuration

git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@872 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Moises Silva 2009-11-16 21:15:54 +00:00
parent c6cf9e61cd
commit 453fe5f72f
2 changed files with 12 additions and 11 deletions

View File

@ -720,6 +720,7 @@ OZ_DECLARE(zap_status_t) zap_channel_add_var(zap_channel_t *zchan, const char *v
OZ_DECLARE(const char *) zap_channel_get_var(zap_channel_t *zchan, const char *var_name);
OZ_DECLARE(zap_status_t) zap_channel_clear_vars(zap_channel_t *zchan);
OZ_DECLARE(zap_status_t) zap_global_init(void);
OZ_DECLARE(zap_status_t) zap_global_configuration(void);
OZ_DECLARE(zap_status_t) zap_global_destroy(void);
OZ_DECLARE(zap_status_t) zap_global_set_memory_handler(zap_memory_handler_t *handler);
OZ_DECLARE(void) zap_global_set_crash_policy(zap_crash_policy_t policy);

View File

@ -2818,8 +2818,6 @@ OZ_DECLARE(zap_status_t) zap_span_start(zap_span_t *span)
OZ_DECLARE(zap_status_t) zap_global_init(void)
{
int modcount;
memset(&globals, 0, sizeof(globals));
time_init();
@ -2830,20 +2828,22 @@ OZ_DECLARE(zap_status_t) zap_global_init(void)
globals.interface_hash = create_hashtable(16, zap_hash_hashfromstring, zap_hash_equalkeys);
globals.module_hash = create_hashtable(16, zap_hash_hashfromstring, zap_hash_equalkeys);
globals.span_hash = create_hashtable(16, zap_hash_hashfromstring, zap_hash_equalkeys);
modcount = 0;
zap_mutex_create(&globals.mutex);
zap_mutex_create(&globals.span_mutex);
return ZAP_FAIL;
}
modcount = zap_load_modules();
OZ_DECLARE(zap_status_t) zap_global_configuration(void)
{
int modcount = zap_load_modules();
zap_log(ZAP_LOG_NOTICE, "Modules configured: %d \n", modcount);
if (load_config() == ZAP_SUCCESS) {
globals.running = 1;
return ZAP_SUCCESS;
if (load_config() != ZAP_SUCCESS) {
globals.running = 0;
zap_log(ZAP_LOG_ERROR, "OpenZap global configuration failed!\n");
return ZAP_FAIL;
}
zap_log(ZAP_LOG_ERROR, "No modules configured!\n");
return ZAP_FAIL;
return ZAP_SUCCESS;
}
OZ_DECLARE(uint32_t) zap_running(void)