diff --git a/include/uv.h b/include/uv.h index de375d4b..5f07fe71 100644 --- a/include/uv.h +++ b/include/uv.h @@ -660,12 +660,12 @@ UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle, unsigned int delay); /* - * This setting applies to Windows only. * Enable/disable simultaneous asynchronous accept requests that are * queued by the operating system when listening for new tcp connections. * This setting is used to tune a tcp server for the desired performance. * Having simultaneous accepts can significantly improve the rate of - * accepting connections (which is why it is enabled by default). + * accepting connections (which is why it is enabled by default) but + * may lead to uneven load distribution in multi-process setups. */ UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable); diff --git a/src/unix/tcp.c b/src/unix/tcp.c index a51576ba..26ab53db 100644 --- a/src/unix/tcp.c +++ b/src/unix/tcp.c @@ -343,11 +343,11 @@ int uv_tcp_keepalive(uv_tcp_t* handle, int on, unsigned int delay) { } -int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int on) { - if (on) - handle->flags |= UV_TCP_SINGLE_ACCEPT; - else +int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) { + if (enable) handle->flags &= ~UV_TCP_SINGLE_ACCEPT; + else + handle->flags |= UV_TCP_SINGLE_ACCEPT; return 0; }