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);
}
/* 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;
}
}