Skip to content

Commit 601969d

Browse files
lecarosedsiper
authored andcommitted
network: use TCP_KEEPALIVE instead of TCP_KEEPIDLE in OSX
Signed-off-by: lecaros <lecaros@calyptia.com>
1 parent 282923d commit 601969d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/flb_network.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,12 @@ int flb_net_socket_tcp_keepalive(flb_sockfd_t fd, struct flb_net_setup *net)
324324
(const void *) &enabled, sizeof(enabled));
325325

326326
if (ret == 0 && time >= 0) {
327-
ret = setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE,
328-
(const void *) &time, sizeof(time));
329-
}
327+
#ifdef __APPLE__
328+
ret = setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE,
329+
#else
330+
ret = setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE,
331+
#endif
332+
(const void *) &time, sizeof(time)); }
330333

331334
if (ret == 0 && interval >= 0) {
332335
ret = setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL,

0 commit comments

Comments
 (0)