Skip to content

Commit

Permalink
network: use TCP_KEEPALIVE instead of TCP_KEEPIDLE in OSX
Browse files Browse the repository at this point in the history
Signed-off-by: lecaros <[email protected]>
  • Loading branch information
lecaros authored and edsiper committed Nov 11, 2024
1 parent 282923d commit 601969d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/flb_network.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,12 @@ int flb_net_socket_tcp_keepalive(flb_sockfd_t fd, struct flb_net_setup *net)
(const void *) &enabled, sizeof(enabled));

if (ret == 0 && time >= 0) {
ret = setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE,
(const void *) &time, sizeof(time));
}
#ifdef __APPLE__
ret = setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE,
#else
ret = setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE,
#endif
(const void *) &time, sizeof(time)); }

if (ret == 0 && interval >= 0) {
ret = setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL,
Expand Down

0 comments on commit 601969d

Please sign in to comment.