summaryrefslogtreecommitdiff
path: root/net.c
diff options
context:
space:
mode:
authorOmriSteiner <51128928+OmriSteiner@users.noreply.github.com>2020-06-22 23:20:30 +0300
committerGitHub <noreply@github.com>2020-06-22 13:20:30 -0700
commit392de5d7f97353485df1237872cb682842e8d83f (patch)
treea45994c209909167bdb09e54cba8c733abb95930 /net.c
parenta28de70a0196275317642eb60f8387a2ee950330 (diff)
fix #785: defer TCP_NODELAY in async tcp connections (#836)
Co-authored-by: Omri Steiner <omri@insoundz.com>
Diffstat (limited to 'net.c')
-rw-r--r--net.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net.c b/net.c
index aa5b183..882e2c4 100644
--- a/net.c
+++ b/net.c
@@ -203,7 +203,7 @@ int redisKeepAlive(redisContext *c, int interval) {
return REDIS_OK;
}
-static int redisSetTcpNoDelay(redisContext *c) {
+int redisSetTcpNoDelay(redisContext *c) {
int yes = 1;
if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof(yes)) == -1) {
__redisSetErrorFromErrno(c,REDIS_ERR_IO,"setsockopt(TCP_NODELAY)");
@@ -487,12 +487,12 @@ addrretry:
wait_for_ready:
if (redisContextWaitReady(c,timeout_msec) != REDIS_OK)
goto error;
+ if (redisSetTcpNoDelay(c) != REDIS_OK)
+ goto error;
}
}
if (blocking && redisSetBlocking(c,1) != REDIS_OK)
goto error;
- if (redisSetTcpNoDelay(c) != REDIS_OK)
- goto error;
c->flags |= REDIS_CONNECTED;
rv = REDIS_OK;