summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2003-05-24 20:42:44 +0000
committerMark Spencer <markster@digium.com>2003-05-24 20:42:44 +0000
commit38c28eb6cb9b4fa4e50a49adf9f042e79c4ed71f (patch)
treec620ca668d3a960a7118fbfacc218e1f8338fbde /channels
parent921ffb5dd72f4b4bc2c1b16ccb758627839e7cc4 (diff)
Restart faster on checking NOTIFY messages on mailboxes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1053 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_sip.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index e4bd5af94..a46c8e56b 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4616,6 +4616,7 @@ static void *do_monitor(void *data)
struct sip_pvt *sip;
struct sip_peer *peer;
time_t t;
+ int fastrestart =0;
/* Add an I/O event to our UDP socket */
if (sipsock > -1)
ast_io_add(io, sipsock, sipsock_read, AST_IO_IN, NULL);
@@ -4653,6 +4654,9 @@ restartsearch:
res = ast_sched_wait(sched);
if ((res < 0) || (res > 1000))
res = 1000;
+ /* If we might need to send more mailboxes, don't wait long at all.*/
+ if (fastrestart)
+ res = 1;
res = ast_io_wait(io, res);
ast_pthread_mutex_lock(&monlock);
if (res >= 0)
@@ -4660,9 +4664,11 @@ restartsearch:
ast_pthread_mutex_lock(&peerl.lock);
peer = peerl.peers;
time(&t);
+ fastrestart = 0;
while(peer) {
if (strlen(peer->mailbox) && ((t - peer->lastmsgcheck) > 10)) {
sip_send_mwi_to_peer(peer);
+ fastrestart = 1;
break;
}
peer = peer->next;