TCP_NODELAY after SYNC: changes to the implementation.

This commit is contained in:
antirez
2013-01-31 11:14:15 +01:00
parent c85647f354
commit b70b459b0e
9 changed files with 40 additions and 26 deletions

View File

@ -75,9 +75,9 @@ int anetNonBlock(char *err, int fd)
return ANET_OK;
}
static int _anetTcpNoDelay(char *err, int fd, int yes)
static int anetSetTcpNoDelay(char *err, int fd, int val)
{
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof(yes)) == -1)
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)) == -1)
{
anetSetError(err, "setsockopt TCP_NODELAY: %s", strerror(errno));
return ANET_ERR;
@ -85,14 +85,14 @@ static int _anetTcpNoDelay(char *err, int fd, int yes)
return ANET_OK;
}
int anetTcpNoDelay(char *err, int fd)
int anetEnableTcpNoDelay(char *err, int fd)
{
return _anetTcpNoDelay(err, fd, 1);
return anetSetTcpNoDelay(err, fd, 1);
}
int anetTcpNoDelayOff(char *err, int fd)
int anetDisableTcpNoDelay(char *err, int fd)
{
return _anetTcpNoDelay(err, fd, 0);
return anetSetTcpNoDelay(err, fd, 0);
}