mirror of
https://github.com/fluencelabs/redis
synced 2025-06-12 08:41:21 +00:00
TCP_NODELAY after SYNC: changes to the implementation.
This commit is contained in:
12
src/anet.c
12
src/anet.c
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user