mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-07 07:59:49 +00:00
FS-2852
This commit is contained in:
parent
92f4344072
commit
1ba98b02b9
@ -1980,19 +1980,16 @@ static char not_so_threadsafe_error_buffer[256] = "";
|
|||||||
SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **err)
|
SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **err)
|
||||||
{
|
{
|
||||||
char path_buf[1024];
|
char path_buf[1024];
|
||||||
uint8_t hasmain = 0, errcnt = 0;
|
uint8_t errcnt = 0;
|
||||||
switch_xml_t new_main, r = NULL;
|
switch_xml_t new_main, r = NULL;
|
||||||
|
|
||||||
switch_mutex_lock(XML_LOCK);
|
switch_mutex_lock(XML_LOCK);
|
||||||
|
|
||||||
if (MAIN_XML_ROOT) {
|
if (MAIN_XML_ROOT) {
|
||||||
hasmain++;
|
|
||||||
|
|
||||||
if (!reload) {
|
if (!reload) {
|
||||||
r = switch_xml_root();
|
r = switch_xml_root();
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
switch_thread_rwlock_wrlock(RWLOCK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "freeswitch.xml");
|
switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "freeswitch.xml");
|
||||||
@ -2007,9 +2004,15 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e
|
|||||||
} else {
|
} else {
|
||||||
switch_xml_t old_root;
|
switch_xml_t old_root;
|
||||||
*err = "Success";
|
*err = "Success";
|
||||||
|
|
||||||
|
switch_thread_rwlock_wrlock(RWLOCK);
|
||||||
|
|
||||||
old_root = MAIN_XML_ROOT;
|
old_root = MAIN_XML_ROOT;
|
||||||
MAIN_XML_ROOT = new_main;
|
MAIN_XML_ROOT = new_main;
|
||||||
switch_set_flag(MAIN_XML_ROOT, SWITCH_XML_ROOT);
|
switch_set_flag(MAIN_XML_ROOT, SWITCH_XML_ROOT);
|
||||||
|
|
||||||
|
switch_thread_rwlock_unlock(RWLOCK);
|
||||||
|
|
||||||
switch_xml_free(old_root);
|
switch_xml_free(old_root);
|
||||||
/* switch_xml_free_in_thread(old_root); */
|
/* switch_xml_free_in_thread(old_root); */
|
||||||
}
|
}
|
||||||
@ -2018,10 +2021,6 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e
|
|||||||
errcnt++;
|
errcnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasmain) {
|
|
||||||
switch_thread_rwlock_unlock(RWLOCK);
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user