]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
freetdm: handle timer id wrap-around
authorMoises Silva <moises.silva@gmail.com>
Tue, 21 Sep 2010 13:46:33 +0000 (09:46 -0400)
committerMoises Silva <moises.silva@gmail.com>
Tue, 21 Sep 2010 13:46:33 +0000 (09:46 -0400)
libs/freetdm/src/ftdm_sched.c

index 340f442c64167b6cb8d73ef298c736f29bad9ecc..be21696d7193992cecc202b2c98a97d8cd7d4961 100644 (file)
@@ -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;