summaryrefslogtreecommitdiff
path: root/net.c
diff options
context:
space:
mode:
authorMichael Grunder <michael.grunder@gmail.com>2023-08-18 21:07:25 -0700
committerGitHub <noreply@github.com>2023-08-18 21:07:25 -0700
commit869f3d0ef1513dd0258ad7190c9914df16dcc4a4 (patch)
treeda35d90b552e3903035c6e2b417ca1127fe68136 /net.c
parent039385bd8b9192a3994d75e75e377933f17d1f47 (diff)
Make redisEnableKeepAlive a no-op on AF_UNIX connections. (#1215)
Fixes #1185
Diffstat (limited to 'net.c')
-rw-r--r--net.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net.c b/net.c
index c7d8271..8b7831e 100644
--- a/net.c
+++ b/net.c
@@ -173,6 +173,10 @@ int redisKeepAlive(redisContext *c, int interval) {
int val = 1;
redisFD fd = c->fd;
+ /* TCP_KEEPALIVE makes no sense with AF_UNIX connections */
+ if (c->connection_type == REDIS_CONN_UNIX)
+ return REDIS_ERR;
+
#ifndef _WIN32
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &val, sizeof(val)) == -1){
__redisSetError(c,REDIS_ERR_OTHER,strerror(errno));