declinatio mortuus obfirmo!

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12248 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-02-23 18:33:59 +00:00
parent 44d2f295a9
commit 333019eb6a
1 changed files with 16 additions and 9 deletions

View File

@ -1830,7 +1830,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e
{ {
char path_buf[1024]; char path_buf[1024];
uint8_t hasmain = 0, errcnt = 0; uint8_t hasmain = 0, errcnt = 0;
switch_xml_t new_main; switch_xml_t new_main, r = NULL;
switch_mutex_lock(XML_LOCK); switch_mutex_lock(XML_LOCK);
@ -1838,8 +1838,8 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e
hasmain++; hasmain++;
if (!reload) { if (!reload) {
switch_mutex_unlock(XML_LOCK); r = switch_xml_root();
return switch_xml_root(); goto done;
} }
switch_thread_rwlock_wrlock(RWLOCK); switch_thread_rwlock_wrlock(RWLOCK);
} }
@ -1871,8 +1871,6 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e
switch_thread_rwlock_unlock(RWLOCK); switch_thread_rwlock_unlock(RWLOCK);
} }
switch_mutex_unlock(XML_LOCK);
if (errcnt == 0) { if (errcnt == 0) {
switch_event_t *event; switch_event_t *event;
if (switch_event_create(&event, SWITCH_EVENT_RELOADXML) == SWITCH_STATUS_SUCCESS) { if (switch_event_create(&event, SWITCH_EVENT_RELOADXML) == SWITCH_STATUS_SUCCESS) {
@ -1880,10 +1878,14 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e
switch_event_destroy(&event); switch_event_destroy(&event);
} }
} }
return switch_xml_root(); r = switch_xml_root();
} }
return NULL; done:
switch_mutex_unlock(XML_LOCK);
return r;
} }
SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t *pool, const char **err) SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t *pool, const char **err)
@ -1908,14 +1910,19 @@ SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t *pool, cons
SWITCH_DECLARE(switch_status_t) switch_xml_destroy(void) SWITCH_DECLARE(switch_status_t) switch_xml_destroy(void)
{ {
switch_status_t status = SWITCH_STATUS_FALSE;
switch_mutex_lock(XML_LOCK);
if (MAIN_XML_ROOT) { if (MAIN_XML_ROOT) {
switch_xml_t xml = MAIN_XML_ROOT; switch_xml_t xml = MAIN_XML_ROOT;
MAIN_XML_ROOT = NULL; MAIN_XML_ROOT = NULL;
switch_xml_free(xml); switch_xml_free(xml);
return SWITCH_STATUS_SUCCESS; status = SWITCH_STATUS_SUCCESS;
} }
return SWITCH_STATUS_FALSE; switch_mutex_unlock(XML_LOCK);
return status;
} }
SWITCH_DECLARE(switch_xml_t) switch_xml_open_cfg(const char *file_path, switch_xml_t *node, switch_event_t *params) SWITCH_DECLARE(switch_xml_t) switch_xml_open_cfg(const char *file_path, switch_xml_t *node, switch_event_t *params)