--- src/lib/ioloop-poll.c.orig 2005-05-12 14:11:53.640361168 +0200 +++ src/lib/ioloop-poll.c 2005-05-13 08:15:16.426617376 +0200 @@ -134,14 +134,32 @@ struct timeval tv; struct io *io; unsigned int t_id; - int msecs, ret, call; + int msecs, msec_wait, ret, call; /* get the time left for next timeout task */ msecs = io_loop_get_wait_time(ioloop->timeouts, &tv, NULL); - ret = poll(data->fds, data->fds_pos, msecs); - if (ret < 0 && errno != EINTR) - i_fatal("poll(): %m"); + while(1) + { + msec_wait = 4000; + if(msecs > 4000) + msecs -= 4000; + else + { + if(msecs >= 0) + { + msec_wait = msecs; + msecs = 0; + } + } + + ret = poll(data->fds, data->fds_pos, msec_wait); + if (ret < 0 && errno != EINTR) + i_fatal("poll(): %m"); + if( (ret == 0) && msec_wait == 4000 ) + i_info("io_loop_handler_run: 4 sec timeout in poll(%d)", msecs); + if( (ret > 0) || msecs == 0) break; + } /* execute timeout handlers */ io_loop_handle_timeouts(ioloop);