Merge "chan_iax2: better handling for timeout and EINTR" into 15

changes/89/9189/1
Joshua Colp 8 years ago committed by Gerrit Code Review
commit 8183184e6f

@ -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;
}
}

Loading…
Cancel
Save