diff options
Diffstat (limited to 'src/anet.c')
-rw-r--r-- | src/anet.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/anet.c b/src/anet.c index 3ded135b0..4ea201df5 100644 --- a/src/anet.c +++ b/src/anet.c @@ -162,6 +162,13 @@ int anetKeepAlive(char *err, int fd, int interval) anetSetError(err, "setsockopt TCP_KEEPCNT: %s\n", strerror(errno)); return ANET_ERR; } +#elif defined(__APPLE__) + /* Set idle time with interval */ + val = interval; + if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &val, sizeof(val)) < 0) { + anetSetError(err, "setsockopt TCP_KEEPALIVE: %s\n", strerror(errno)); + return ANET_ERR; + } #else ((void) interval); /* Avoid unused var warning for non Linux systems. */ #endif |