diff --git a/connection/connection.c b/connection/connection.c index 7aea2afb..889950c8 100644 --- a/connection/connection.c +++ b/connection/connection.c @@ -117,8 +117,8 @@ _read_queue(struct connection_pool * pool, int timeout) { int n = epoll_wait(pool->epoll_fd , pool->ev, EPOLLQUEUE, timeout); #elif HAVE_KQUEUE struct timespec timeoutspec; - timeoutspec.tv_sec = timeout; - timeoutspec.tv_nsec = 0; + timeoutspec.tv_sec = timeout / 1000; + timeoutspec.tv_nsec = (timeout % 1000) * 1000000; int n = kevent(pool->kqueue_fd, NULL, 0, pool->ev, EPOLLQUEUE, &timeoutspec); #endif if (n == -1) { diff --git a/gate/mread.c b/gate/mread.c index 4e8ff13b..665264e6 100644 --- a/gate/mread.c +++ b/gate/mread.c @@ -235,8 +235,8 @@ _read_queue(struct mread_pool * self, int timeout) { int n = epoll_wait(self->epoll_fd , self->ev, READQUEUE, timeout); #elif HAVE_KQUEUE struct timespec timeoutspec; - timeoutspec.tv_sec = timeout; - timeoutspec.tv_nsec = 0; + timeoutspec.tv_sec = timeout / 1000; + timeoutspec.tv_nsec = (timeout % 1000) * 1000000; int n = kevent(self->kqueue_fd, NULL, 0, self->ev, READQUEUE, &timeoutspec); #endif if (n == -1) {