]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
split initialization from configuration
authorMoises Silva <moy@sangoma.com>
Mon, 16 Nov 2009 21:15:54 +0000 (21:15 +0000)
committerMoises Silva <moy@sangoma.com>
Mon, 16 Nov 2009 21:15:54 +0000 (21:15 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@872 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/freetdm/src/include/openzap.h
libs/freetdm/src/zap_io.c

index 7052d8e17b3ea0fccc85e42e027dfa15d528de45..4024b40d3165378b5cdca5d49d8cde4dcb88a105 100644 (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);
index 3a623f3db7bbde58c1ae1ca04a76edaf3355aa2d..fba9453e2ca52d8fb88b55f5dfeda7e8d365f53b 100644 (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);
-       
-       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)