--- /tmp/jabberd-2.2.14/mio/mio_impl.h 2011-05-31 15:11:38.000000000 -0700 +++ ./jabberd2/mio/mio_impl.h 2011-06-22 20:13:00.000000000 -0700 @@ -243,7 +243,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 */ @@ -251,7 +251,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 */ @@ -270,6 +270,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) @@ -347,8 +348,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;