diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-12-15 06:28:05 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-12-15 06:28:05 +0000 |
commit | 53468c437b403aa2a09d7d59ab39963526ae1898 (patch) | |
tree | 10a01ae71356e17b4bfab3cef25bfd5fadd75b7a /channels | |
parent | 349946aa3dd31ba2bce9b49e11d86883013ba31f (diff) |
Use a wakeup variable so that we don't wait on IO indefinitely if packets need to be retransmitted.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@48478 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_iax2.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index eca700724..ebed2cf3a 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -8009,7 +8009,7 @@ static void *network_thread(void *ignore) { /* Our job is simple: Send queued messages, retrying if necessary. Read frames from the network, and queue them for delivery to the channels */ - int res, count; + int res, count, wakeup; struct iax_frame *f; if (timingfd > -1) @@ -8020,13 +8020,16 @@ static void *network_thread(void *ignore) sent, and scheduling retransmissions if appropriate */ AST_LIST_LOCK(&iaxq.queue); count = 0; + wakeup = -1; AST_LIST_TRAVERSE_SAFE_BEGIN(&iaxq.queue, f, list) { if (f->sentyet) continue; /* Try to lock the pvt, if we can't... don't fret - defer it till later */ - if (ast_mutex_trylock(&iaxsl[f->callno])) + if (ast_mutex_trylock(&iaxsl[f->callno])) { + wakeup = 1; continue; + } f->sentyet++; @@ -8057,7 +8060,7 @@ static void *network_thread(void *ignore) ast_log(LOG_DEBUG, "chan_iax2: Sent %d queued outbound frames all at once\n", count); /* Now do the IO, and run scheduled tasks */ - res = ast_io_wait(io, -1); + res = ast_io_wait(io, wakeup); if (res >= 0) { if (res >= 20) ast_log(LOG_DEBUG, "chan_iax2: ast_io_wait ran %d I/Os all at once\n", res); |