summaryrefslogtreecommitdiff
path: root/net.c
diff options
context:
space:
mode:
Diffstat (limited to 'net.c')
-rw-r--r--net.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net.c b/net.c
index bf571fc..3c07d68 100644
--- a/net.c
+++ b/net.c
@@ -122,6 +122,13 @@ int redisKeepAlive(redisContext *c, int interval) {
return REDIS_ERR;
}
+#ifdef _OSX
+ val = interval;
+ if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &val, sizeof(val)) < 0) {
+ __redisSetError(c,REDIS_ERR_OTHER,strerror(errno));
+ return REDIS_ERR;
+ }
+#else
val = interval;
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &val, sizeof(val)) < 0) {
__redisSetError(c,REDIS_ERR_OTHER,strerror(errno));
@@ -140,6 +147,7 @@ int redisKeepAlive(redisContext *c, int interval) {
__redisSetError(c,REDIS_ERR_OTHER,strerror(errno));
return REDIS_ERR;
}
+#endif
return REDIS_OK;
}