diff options
author | zuul <zuul@gerrit.asterisk.org> | 2017-01-17 18:44:02 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-01-17 18:44:02 -0600 |
commit | fb02cc5a8bae22f2eca4f60d84550b30a19d723a (patch) | |
tree | 4c648371b9c23a9227b6c284927ea6913bcffbfa | |
parent | fdf481636ae178d21a59c11b093efdc85cd398a9 (diff) | |
parent | aad29b9bcac936d511c3b8905fd458bfa6e6dde3 (diff) |
Merge "res_calendar: delete old calendars after reload"
-rw-r--r-- | res/res_calendar.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/res/res_calendar.c b/res/res_calendar.c index 46775507c..92b73c1ed 100644 --- a/res/res_calendar.c +++ b/res/res_calendar.c @@ -406,7 +406,12 @@ static struct ast_calendar *build_calendar(struct ast_config *cfg, const char *c struct ast_variable *v, *last = NULL; int new_calendar = 0; - if (!(cal = find_calendar(cat))) { + cal = find_calendar(cat); + if (cal && cal->fetch_again_at_reload) { + /** Create new calendar, old will be removed during reload */ + cal = unref_calendar(cal); + } + if (!cal) { new_calendar = 1; if (!(cal = ao2_alloc(sizeof(*cal), calendar_destructor))) { ast_log(LOG_ERROR, "Could not allocate calendar structure. Stopping.\n"); @@ -483,7 +488,7 @@ static struct ast_calendar *build_calendar(struct ast_config *cfg, const char *c } } - if (new_calendar || cal->fetch_again_at_reload) { + if (new_calendar) { cal->thread = AST_PTHREADT_NULL; ast_cond_init(&cal->unload, NULL); ao2_link(calendars, cal); |