[Asterisk-cvs] zaptel zaptel.c,1.105,1.106

markster at lists.digium.com markster at lists.digium.com
Wed May 18 01:12:13 CDT 2005


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv3420

Modified Files:
	zaptel.c 
Log Message:
Don't make unnecessary sethook calls


Index: zaptel.c
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -d -r1.105 -r1.106
--- zaptel.c	2 May 2005 20:15:07 -0000	1.105
+++ zaptel.c	18 May 2005 05:17:22 -0000	1.106
@@ -1885,8 +1885,10 @@
 		return;
 	}
 	if (chan->span->hooksig) {
-		chan->txhooksig = txsig;
-		chan->span->hooksig(chan, txsig);
+		if (chan->txhooksig != txsig) {
+			chan->txhooksig = txsig;
+			chan->span->hooksig(chan, txsig);
+		}
 		chan->otimer = timeout * 8;			/* Otimer is timer in samples */
 		return;
 	} else {
@@ -1946,8 +1948,13 @@
 			zt_rbs_sethook(chan, ZT_TXSIG_ONHOOK, ZT_TXSTATE_ONHOOK, 0);
 	} else {
 		/* Let the driver hang up the line if it wants to  */
-		if (chan->span->sethook)
-			res = chan->span->sethook(chan, ZT_ONHOOK);
+		if (chan->span->sethook) {
+			if (chan->txhooksig != ZT_ONHOOK) {
+				chan->txhooksig = ZT_ONHOOK;
+				res = chan->span->sethook(chan, ZT_ONHOOK);
+			} else
+				res = 0;
+		}
 	}
 	/* if not registered yet, just return here */
 	if (!(chan->flags & ZT_FLAG_REGISTERED)) return res;
@@ -4233,9 +4240,12 @@
 			default:
 				return -EINVAL;
 			}
-		} else if (chan->span->sethook) 
-			chan->span->sethook(chan, j);
-		else
+		} else if (chan->span->sethook) {
+			if (chan->txhooksig != j) {
+				chan->txhooksig = j;
+				chan->span->sethook(chan, j);
+			}
+		} else
 			return -ENOSYS;
 		break;
 #ifdef CONFIG_ZAPATA_PPP




More information about the svn-commits mailing list