From 61e9680b02eb6a28a46cded3f752cdd4526fbdc7 Mon Sep 17 00:00:00 2001 From: russell Date: Fri, 29 May 2009 22:33:31 +0000 Subject: Improve handling of trying to ACK too many timer expirations. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@198183 f38db490-d61c-443f-a65b-d21fe96a405b --- res/res_timing_pthread.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'res') 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]; -- cgit v1.2.3