From 0c96b8e32d842e2ded97efa6335c17f2647ee402 Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Wed, 7 Oct 2009 04:56:32 +0000 Subject: [PATCH] mod_fifo: gracefully fail on missing config file git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15106 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/applications/mod_fifo/mod_fifo.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 698d3def53..a4a4ca53b3 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -2254,6 +2254,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load) { switch_application_interface_t *app_interface; switch_api_interface_t *commands_api_interface; + switch_status_t status; /* create/register custom event message type */ if (switch_event_reserve_subclass(FIFO_EVENT) != SWITCH_STATUS_SUCCESS) { @@ -2272,6 +2273,16 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load) switch_core_hash_init(&globals.fifo_hash, globals.pool); switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); switch_mutex_init(&globals.sql_mutex, SWITCH_MUTEX_NESTED, globals.pool); + + globals.running = 1; + + if ((status = load_config(0,1)) != SWITCH_STATUS_SUCCESS) { + switch_event_unbind(&globals.node); + switch_event_free_subclass(FIFO_EVENT); + switch_core_hash_destroy(&globals.fifo_hash); + switch_core_destroy_memory_pool(&globals.pool); + return status; + } /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); @@ -2284,9 +2295,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load) switch_console_set_complete("add fifo count"); switch_console_set_complete("add fifo importance"); - globals.running = 1; - - load_config(0,1); start_node_thread(globals.pool); return SWITCH_STATUS_SUCCESS;