sched.c: Add warning about negative time interval request.
authorRichard Mudgett <rmudgett@digium.com>
Mon, 28 Sep 2015 20:31:38 +0000 (15:31 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 30 Sep 2015 15:47:12 +0000 (10:47 -0500)
Change-Id: Ib91435fb45b7f5f7c0fc83d0eec20b88098707bc

main/sched.c

index 8f9e84b..a7e6703 100644 (file)
@@ -450,6 +450,17 @@ static int sched_settime(struct timeval *t, int when)
 {
        struct timeval now = ast_tvnow();
 
+       if (when < 0) {
+               /*
+                * A negative when value is likely a bug as it
+                * represents a VERY large timeout time.
+                */
+               ast_log(LOG_WARNING,
+                       "Bug likely: Negative time interval %d (interpreted as %u ms) requested!\n",
+                       when, (unsigned int) when);
+               ast_assert(0);
+       }
+
        /*ast_debug(1, "TV -> %lu,%lu\n", tv->tv_sec, tv->tv_usec);*/
        if (ast_tvzero(*t))     /* not supplied, default to now */
                *t = now;