提交 453fe5f7 authored 作者: Moises Silva's avatar Moises Silva

split initialization from configuration

git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@872 a93c3328-9c30-0410-af19-c9cd2b2d52af
上级 c6cf9e61
......@@ -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);
......
......@@ -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);
modcount = zap_load_modules();
return ZAP_FAIL;
}
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)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论