diff --git a/common/time_mosq.c b/common/time_mosq.c index 8e45963d..468d80a3 100644 --- a/common/time_mosq.c +++ b/common/time_mosq.c @@ -21,6 +21,7 @@ Contributors: #ifdef __APPLE__ #include #include +#include #endif #ifdef WIN32 diff --git a/src/bridge.c b/src/bridge.c index aea28feb..793a15fc 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -197,7 +197,9 @@ static int bridge__set_tcp_keepalive(struct mosquitto *context) #else ret = setsockopt(context->sock, SOL_SOCKET, SO_KEEPALIVE, (const void*)&enabled, sizeof(enabled)) || +#ifndef __APPLE__ setsockopt(context->sock, IPPROTO_TCP, TCP_KEEPIDLE, (const void*)&idle, sizeof(idle)) || +#endif setsockopt(context->sock, IPPROTO_TCP, TCP_KEEPINTVL, (const void*)&interval, sizeof(interval)) || setsockopt(context->sock, IPPROTO_TCP, TCP_KEEPCNT, (const void*)&counter, sizeof(counter)); #endif diff --git a/src/context.c b/src/context.c index 5fc27e66..9d3a07ec 100644 --- a/src/context.c +++ b/src/context.c @@ -20,6 +20,9 @@ Contributors: #include #include +#ifdef __APPLE__ +#include +#endif #include "mosquitto_broker_internal.h" #include "alias_mosq.h" @@ -318,4 +321,3 @@ void context__remove_from_by_id(struct mosquitto *context) context->in_by_id = false; } } -