aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authortwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-23 17:21:40 +0000
committertwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-23 17:21:40 +0000
commitbb77d2a218ba6f8147f8fc44282fee9ba7a223ba (patch)
treefbbea5147daa6cea77599954705fdae44021a453 /apps
parent6322941552bdb1d8ce82f0f73801981f1838b049 (diff)
Make sure reload updates SLA config
Even if there are no stations or trunks defined, we need to start the sla thread to make sure we get the reload event. Also, when doing a reload we need to remove the existing trunks and stations or they end up hanging around. (closes issue #16818) Reported by: mbonin Patches: sla_reload.patch uploaded by twilson (license 396) Tested by: twilson git-svn-id: http://svn.digium.com/svn/asterisk/trunk@272109 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_meetme.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index d0cc831e8..bcd2be476 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -5675,6 +5675,19 @@ static void sla_check_reload(void)
return;
}
+ /* We need to actually delete the previous versions of trunks and stations now */
+ AST_RWLIST_TRAVERSE_SAFE_BEGIN(&sla_stations, station, entry) {
+ AST_RWLIST_REMOVE_CURRENT(entry);
+ ast_free(station);
+ }
+ AST_RWLIST_TRAVERSE_SAFE_END;
+
+ AST_RWLIST_TRAVERSE_SAFE_BEGIN(&sla_trunks, trunk, entry) {
+ AST_RWLIST_REMOVE_CURRENT(entry);
+ ast_free(trunk);
+ }
+ AST_RWLIST_TRAVERSE_SAFE_END;
+
/* yay */
sla_load_config(1);
sla.reload = 0;
@@ -5727,8 +5740,9 @@ static void *sla_thread(void *data)
ast_mutex_lock(&sla.lock);
}
- if (sla.reload)
+ if (sla.reload) {
sla_check_reload();
+ }
}
ast_mutex_unlock(&sla.lock);
@@ -6599,8 +6613,11 @@ static int sla_load_config(int reload)
ast_config_destroy(cfg);
- if (!reload && (!AST_LIST_EMPTY(&sla_stations) || !AST_LIST_EMPTY(&sla_stations)))
+ /* Even if we don't have any stations, we may after a reload and we need to
+ * be able to process the SLA_EVENT_RELOAD event in that case */
+ if (!reload) {
ast_pthread_create(&sla.thread, NULL, sla_thread, NULL);
+ }
return res;
}