mirror of
https://github.com/asterisk/asterisk.git
synced 2026-06-16 04:36:49 +00:00
chan_iax2: better handling for timeout and EINTR
The iax2 module is not handling timeout and EINTR case properly. Mainly when there is an interupt to the kernel thread. In case of ast_io_wait recieves a signal, or timeout it can be an error or return 0 which eventually escapes the thread loop, so that it cant recieve any data. This then causes the modules receive queue to build up on the kernel and stop any communications via iax in asterisk. The proposed patch is for the iax module, so that timeout and EINTR does not exit the thread. ASTERISK-27705 Reported-by: Kirsty Tyerman Change-Id: Ib4c32562f69335869adc1783608e940c3535fbfb
This commit is contained in:
@@ -12552,6 +12552,8 @@ static struct ast_channel *iax2_request(const char *type, struct ast_format_cap
|
||||
|
||||
static void *network_thread(void *ignore)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (timer) {
|
||||
ast_io_add(io, ast_timer_fd(timer), timing_read, AST_IO_IN | AST_IO_PRI, NULL);
|
||||
}
|
||||
@@ -12561,7 +12563,11 @@ static void *network_thread(void *ignore)
|
||||
/* Wake up once a second just in case SIGURG was sent while
|
||||
* we weren't in poll(), to make sure we don't hang when trying
|
||||
* to unload. */
|
||||
if (ast_io_wait(io, 1000) <= 0) {
|
||||
res = ast_io_wait(io, 1000);
|
||||
/* Timeout(=0), and EINTR is not a thread exit condition. We do
|
||||
* not want to exit the thread loop on these conditions. */
|
||||
if (res < 0 && errno != -EINTR) {
|
||||
ast_log(LOG_ERROR, "IAX2 network thread unexpected exit: %s\n", strerror(errno));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user