[Asterisk-cvs] asterisk channel.c,1.73.2.7,1.73.2.8

markster at lists.digium.com markster at lists.digium.com
Fri Mar 5 13:40:00 CST 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv9617

Modified Files:
      Tag: v1-0_stable
	channel.c 
Log Message:
Set SOFTHANGUP_TIMEOUT if appropriate


Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.73.2.7
retrieving revision 1.73.2.8
diff -u -d -r1.73.2.7 -r1.73.2.8
--- channel.c	5 Mar 2004 18:23:43 -0000	1.73.2.7
+++ channel.c	5 Mar 2004 18:31:24 -0000	1.73.2.8
@@ -811,7 +811,7 @@
 	fd_set rfds, efds;
 	int res;
 	int x, y, max=-1;
-	time_t now;
+	time_t now = 0;
 	long whentohangup = 0, havewhen = 0, diff;
 	struct ast_channel *winner = NULL;
 	if (outfd)
@@ -819,11 +819,12 @@
 	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) {
+			if (!havewhen)
+				time(&now);
 			diff = c[x]->whentohangup - now;
 			if (!havewhen || (diff < whentohangup)) {
 				havewhen++;
@@ -890,8 +891,12 @@
 		return NULL;
 	}
 
+	if (havewhen)
+		time(&now);
 	for (x=0;x<n;x++) {
 		c[x]->blocking = 0;
+		if (havewhen && c[x]->whentohangup && (now > c[x]->whentohangup))
+			c[x]->_softhangup |= AST_SOFTHANGUP_TIMEOUT;
 		for (y=0;y<AST_MAX_FDS;y++) {
 			if (c[x]->fds[y] > -1) {
 				if ((FD_ISSET(c[x]->fds[y], &rfds) || FD_ISSET(c[x]->fds[y], &efds)) && !winner) {




More information about the svn-commits mailing list