mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-03 11:11:05 +00:00
Merge "res_calendar: delete old calendars after reload"
This commit is contained in:
@@ -406,7 +406,12 @@ static struct ast_calendar *build_calendar(struct ast_config *cfg, const char *c
|
|||||||
struct ast_variable *v, *last = NULL;
|
struct ast_variable *v, *last = NULL;
|
||||||
int new_calendar = 0;
|
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;
|
new_calendar = 1;
|
||||||
if (!(cal = ao2_alloc(sizeof(*cal), calendar_destructor))) {
|
if (!(cal = ao2_alloc(sizeof(*cal), calendar_destructor))) {
|
||||||
ast_log(LOG_ERROR, "Could not allocate calendar structure. Stopping.\n");
|
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;
|
cal->thread = AST_PTHREADT_NULL;
|
||||||
ast_cond_init(&cal->unload, NULL);
|
ast_cond_init(&cal->unload, NULL);
|
||||||
ao2_link(calendars, cal);
|
ao2_link(calendars, cal);
|
||||||
|
Reference in New Issue
Block a user