Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
bb3c4c17
Commit
bb3c4c17
authored
May 01, 2013
by
Pieter Noordhuis
Browse files
Make redisKeepAlive work on OSX
parent
9dff5105
Changes
2
Show whitespace changes
Inline
Side-by-side
fmacros.h
View file @
bb3c4c17
...
...
@@ -13,4 +13,8 @@
#define _XOPEN_SOURCE
#endif
#if __APPLE__ && __MACH__
#define _OSX
#endif
#endif
net.c
View file @
bb3c4c17
...
...
@@ -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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment