summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-05-18 05:17:22 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-05-18 05:17:22 +0000
commit07ef1c0ca7d37dadc85af0762179ac153e84bf18 (patch)
tree3100ad2e2d19bdf0bcc58adb3fc54b1a4897b6c7
parent059c618188f07bacc2dc44cb3c5ddc0f6f121432 (diff)
Don't make unnecessary sethook calls
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@647 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-xzaptel.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/zaptel.c b/zaptel.c
index 8385f29..77d1eea 100755
--- a/zaptel.c
+++ b/zaptel.c
@@ -1885,8 +1885,10 @@ who cares what the sig bits are as long as they are stable */
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 @@ static int zt_hangup(struct zt_chan *chan)
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 @@ static int zt_chan_ioctl(struct inode *inode, struct file *file, unsigned int cm
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