From 601969d2dee2268017a1064cea7ec159a11d8510 Mon Sep 17 00:00:00 2001 From: lecaros Date: Sat, 9 Nov 2024 22:12:10 -0300 Subject: [PATCH] network: use TCP_KEEPALIVE instead of TCP_KEEPIDLE in OSX Signed-off-by: lecaros --- src/flb_network.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/flb_network.c b/src/flb_network.c index f9c5bb976a7..8f8ca33f602 100644 --- a/src/flb_network.c +++ b/src/flb_network.c @@ -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,