From baead3ddf0abc03c7986ebfd33ecfbfd304781d7 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 21 Sep 2010 09:46:33 -0400 Subject: [PATCH] freetdm: handle timer id wrap-around --- libs/freetdm/src/ftdm_sched.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/freetdm/src/ftdm_sched.c b/libs/freetdm/src/ftdm_sched.c index 340f442c64..be21696d71 100644 --- a/libs/freetdm/src/ftdm_sched.c +++ b/libs/freetdm/src/ftdm_sched.c @@ -325,6 +325,13 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name } newtimer->id = sched->currid; sched->currid++; + if (!sched->currid) { + ftdm_log(FTDM_LOG_NOTICE, "Timer id wrap around for sched %s\n", sched->name); + /* we do not want currid to be zero since is an invalid id + * TODO: check that currid does not exists already in the context, it'd be insane + * though, having a timer to live all that time */ + sched->currid++; + } ftdm_set_string(newtimer->name, name); newtimer->callback = callback;