summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2015-10-02 16:27:13 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-10-02 16:27:13 -0500
commit64701bdb01bcb22782babbafdd331bdb31c62723 (patch)
tree87c4cbef22b5ba21c5d08a90f3ee6473b1deffa1
parent56ed7b9dd560e468be31684e56a8070b88ae0205 (diff)
parentddebb217f00c00e95259d3977d6d8b43adc69c65 (diff)
Merge "sched.c: Add warning about negative time interval request." into 13
-rw-r--r--main/sched.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/main/sched.c b/main/sched.c
index 89ef9aefc..e92e3ffd0 100644
--- a/main/sched.c
+++ b/main/sched.c
@@ -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;