--- /tmp/jabberd-2.1.24.1/mio/mio_impl.h 2008-04-27 02:57:34.000000000 -0700 +++ ./jabberd2/mio/mio_impl.h 2009-05-07 10:06:48.000000000 -0700 @@ -239,7 +239,7 @@ static void _mio_run(mio_t m, int timeou if(FD(m,fd)->type == type_LISTEN && MIO_CAN_READ(m,iter)) { _mio_accept(m, fd); - continue; + goto deferred; } /* check for connecting sockets */ @@ -247,7 +247,7 @@ static void _mio_run(mio_t m, int timeou (MIO_CAN_READ(m,iter) || MIO_CAN_WRITE(m,iter))) { _mio__connect(m, fd); - continue; + goto deferred; } /* read from ready sockets */ @@ -266,6 +266,7 @@ static void _mio_run(mio_t m, int timeou MIO_UNSET_WRITE(m, FD(m,fd)); } + deferred: /* deferred closing fd * one of previous actions might change the state of fd */ if(FD(m,fd)->type == type_CLOSED) @@ -343,8 +344,8 @@ static mio_fd_t _mio_listen(mio_t m, int return NULL; } - /* start listening with a max accept queue of 10 */ - if(listen(fd, 10) < 0) + /* start listening with a max accept queue specified by kern.ipc.somaxconn sysctl */ + if(listen(fd, -1) < 0) { close(fd); return NULL;