[asterisk-commits] rmudgett: branch 1.8 r352029 - in /branches/1.8: funcs/func_timeout.c main/app.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 20 18:20:11 CST 2012


Author: rmudgett
Date: Fri Jan 20 18:20:07 2012
New Revision: 352029

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=352029
Log:
Fix ast_app_dtget() time unit inconsistency.

Note: Noone calls ast_app_dtget() with the timeout parameter of zero so
the bad code normally will never get executed.

* Fix unnecessary floating point division in func_timeout.c
timeout_write() when all other values are integers.

(closes issue ASTERISK-16817)
Reported by: Dmitry Andrianov

Modified:
    branches/1.8/funcs/func_timeout.c
    branches/1.8/main/app.c

Modified: branches/1.8/funcs/func_timeout.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/funcs/func_timeout.c?view=diff&rev=352029&r1=352028&r2=352029
==============================================================================
--- branches/1.8/funcs/func_timeout.c (original)
+++ branches/1.8/funcs/func_timeout.c Fri Jan 20 18:20:07 2012
@@ -171,7 +171,7 @@
 	case 'r':
 	case 'R':
 		if (chan->pbx) {
-			chan->pbx->rtimeoutms = when.tv_sec * 1000 + when.tv_usec / 1000.0;
+			chan->pbx->rtimeoutms = when.tv_sec * 1000 + when.tv_usec / 1000;
 			ast_verb(3, "Response timeout set to %.3f\n", chan->pbx->rtimeoutms / 1000.0);
 		}
 		break;
@@ -179,7 +179,7 @@
 	case 'd':
 	case 'D':
 		if (chan->pbx) {
-			chan->pbx->dtimeoutms = when.tv_sec * 1000 + when.tv_usec / 1000.0;
+			chan->pbx->dtimeoutms = when.tv_sec * 1000 + when.tv_usec / 1000;
 			ast_verb(3, "Digit timeout set to %.3f\n", chan->pbx->dtimeoutms / 1000.0);
 		}
 		break;

Modified: branches/1.8/main/app.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/app.c?view=diff&rev=352029&r1=352028&r2=352029
==============================================================================
--- branches/1.8/main/app.c (original)
+++ branches/1.8/main/app.c Fri Jan 20 18:20:07 2012
@@ -108,7 +108,7 @@
  * \param collect
  * \param size
  * \param maxlen
- * \param timeout timeout in seconds
+ * \param timeout timeout in milliseconds
  *
  * \return 0 if extension does not exist, 1 if extension exists
 */
@@ -121,10 +121,12 @@
 		maxlen = size;
 	}
 
-	if (!timeout && chan->pbx) {
-		timeout = chan->pbx->dtimeoutms / 1000.0;
-	} else if (!timeout) {
-		timeout = 5;
+	if (!timeout) {
+		if (chan->pbx && chan->pbx->dtimeoutms) {
+			timeout = chan->pbx->dtimeoutms;
+		} else {
+			timeout = 5000;
+		}
 	}
 
 	if ((ts = ast_get_indication_tone(chan->zone, "dial"))) {




More information about the asterisk-commits mailing list