unix: fix uv_tcp_simultaneous_accepts() logic

Inverts the meaning of the 'enable' argument. Before, it actually set
the UV_TCP_SINGLE_ACCEPT flag when enable=1. Now it clears it, which is
what uv-win does and what you would expect it to do.
This commit is contained in:
Ben Noordhuis 2013-03-12 01:02:28 +01:00
parent 2f84a57566
commit 905d56c140
2 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -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;
}