summaryrefslogtreecommitdiff
path: root/res/res_timing_pthread.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2009-05-29 22:33:31 +0000
committerRussell Bryant <russell@russellbryant.com>2009-05-29 22:33:31 +0000
commit04beecc8590342aa536caa2b9656afe77659c318 (patch)
treeb05982f760ccde8c956d0860ff554d997c1a6e01 /res/res_timing_pthread.c
parentc317d8f444ab33fe2660d318195fc31b8c86cd47 (diff)
Improve handling of trying to ACK too many timer expirations.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198183 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_timing_pthread.c')
-rw-r--r--res/res_timing_pthread.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/res/res_timing_pthread.c b/res/res_timing_pthread.c
index 5e3c31364..86ae1bb42 100644
--- a/res/res_timing_pthread.c
+++ b/res/res_timing_pthread.c
@@ -357,9 +357,21 @@ static int check_timer(struct pthread_timer *timer)
static void read_pipe(struct pthread_timer *timer, unsigned int quantity)
{
int rd_fd = timer->pipe[PIPE_READ];
+ int pending_ticks = timer->pending_ticks;
ast_assert(quantity);
- ast_assert(quantity >= timer->pending_ticks);
+
+ if (timer->continuous && pending_ticks) {
+ pending_ticks--;
+ }
+
+ if (quantity > pending_ticks) {
+ quantity = pending_ticks;
+ }
+
+ if (!quantity) {
+ return;
+ }
do {
unsigned char buf[1024];