提交 1ba98b02 authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-2852

上级 92f43440
...@@ -1980,19 +1980,16 @@ static char not_so_threadsafe_error_buffer[256] = ""; ...@@ -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 ...@@ -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 ...@@ -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) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论