[Asterisk-code-review] sched.c: Add warning about negative time interval request. (asterisk[11])
Richard Mudgett
asteriskteam at digium.com
Wed Sep 30 13:53:45 CDT 2015
Richard Mudgett has uploaded a new change for review.
https://gerrit.asterisk.org/1349
Change subject: sched.c: Add warning about negative time interval request.
......................................................................
sched.c: Add warning about negative time interval request.
Change-Id: Ib91435fb45b7f5f7c0fc83d0eec20b88098707bc
---
M main/sched.c
1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/49/1349/1
diff --git a/main/sched.c b/main/sched.c
index f00b152..366bb9a 100644
--- a/main/sched.c
+++ b/main/sched.c
@@ -474,6 +474,17 @@
{
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;
--
To view, visit https://gerrit.asterisk.org/1349
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib91435fb45b7f5f7c0fc83d0eec20b88098707bc
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
More information about the asterisk-code-review
mailing list