diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 6420b5d6eb22c367b135e93e5137c1cd72912279..01d42b57fa20db5e4554b0cef4e7641d680a6814 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -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; } }