[Asterisk-cvs] asterisk channel.c,1.73.2.6,1.73.2.7
markster at lists.digium.com
markster at lists.digium.com
Fri Mar 5 13:32:19 CST 2004
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv9530
Modified Files:
Tag: v1-0_stable
channel.c
Log Message:
Keep in mind the absolute timeout in ast_waitfor (bug #1107)
Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.73.2.6
retrieving revision 1.73.2.7
diff -u -d -r1.73.2.6 -r1.73.2.7
--- channel.c 1 Mar 2004 16:15:22 -0000 1.73.2.6
+++ channel.c 5 Mar 2004 18:23:43 -0000 1.73.2.7
@@ -811,15 +811,25 @@
fd_set rfds, efds;
int res;
int x, y, max=-1;
+ time_t now;
+ long whentohangup = 0, havewhen = 0, diff;
struct ast_channel *winner = NULL;
if (outfd)
- *outfd = -1;
+ *outfd = -99999;
if (exception)
*exception = 0;
+ time(&now);
/* Perform any pending masquerades */
for (x=0;x<n;x++) {
ast_mutex_lock(&c[x]->lock);
+ if (c[x]->whentohangup) {
+ diff = c[x]->whentohangup - now;
+ if (!havewhen || (diff < whentohangup)) {
+ havewhen++;
+ whentohangup = diff;
+ }
+ }
if (c[x]->masq) {
if (ast_do_masquerade(c[x])) {
ast_log(LOG_WARNING, "Masquerade failed\n");
@@ -833,6 +843,13 @@
tv.tv_sec = *ms / 1000;
tv.tv_usec = (*ms % 1000) * 1000;
+
+ if (havewhen) {
+ if ((*ms < 0) || (whentohangup * 1000 < *ms)) {
+ tv.tv_sec = whentohangup / 1000;
+ tv.tv_usec = (whentohangup % 1000) * 1000;
+ }
+ }
FD_ZERO(&rfds);
FD_ZERO(&efds);
@@ -853,7 +870,7 @@
if (fds[x] > max)
max = fds[x];
}
- if (*ms >= 0)
+ if ((*ms >= 0) || (havewhen))
res = ast_select(max + 1, &rfds, NULL, &efds, &tv);
else
res = ast_select(max + 1, &rfds, NULL, &efds, NULL);
More information about the svn-commits
mailing list