--- /tmp/jabberd-2.2.13/mio/mio_impl.h 2011-02-23 08:24:35.000000000 -0800 +++ ./jabberd2/mio/mio_impl.h 2011-02-24 16:25:21.000000000 -0800 @@ -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;