From a3be4e8e72568a24259719e444d343527bfaaa66 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 3 Mar 2008 19:32:42 +0000 Subject: [PATCH] add reloadxml event git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7775 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_types.h | 2 ++ src/switch_event.c | 1 + src/switch_xml.cpp | 12 +++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 5743ac4e3e..59dadead2c 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -988,6 +988,7 @@ typedef enum { SWITCH_EVENT_DEL_SCHEDULE - Something has been unscheduled SWITCH_EVENT_EXE_SCHEDULE - Something scheduled has been executed SWITCH_EVENT_RE_SCHEDULE - Something scheduled has been rescheduled + SWITCH_EVENT_RELOADXML - XML registry has been reloaded SWITCH_EVENT_ALL - All events at once @@ -1041,6 +1042,7 @@ typedef enum { SWITCH_EVENT_DEL_SCHEDULE, SWITCH_EVENT_EXE_SCHEDULE, SWITCH_EVENT_RE_SCHEDULE, + SWITCH_EVENT_RELOADXML, SWITCH_EVENT_ALL } switch_event_types_t; diff --git a/src/switch_event.c b/src/switch_event.c index 287762e56c..3364da1209 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -126,6 +126,7 @@ static char *EVENT_NAMES[] = { "DEL_SCHEDULE", "EXE_SCHEDULE", "RE_SCHEDULE", + "RELOADXML", "ALL" }; diff --git a/src/switch_xml.cpp b/src/switch_xml.cpp index 2f675a3c86..7990d83c46 100644 --- a/src/switch_xml.cpp +++ b/src/switch_xml.cpp @@ -1479,7 +1479,17 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e } switch_mutex_unlock(XML_LOCK); - return errcnt == 0 ? switch_xml_root() : NULL; + if (errcnt == 0) { + switch_event_t *event; + if (switch_event_create(&event, SWITCH_EVENT_RELOADXML) == SWITCH_STATUS_SUCCESS) { + if (switch_event_fire(&event) != SWITCH_STATUS_SUCCESS) { + switch_event_destroy(&event); + } + } + return switch_xml_root(); + } + + return NULL; } SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t *pool, const char **err)