From ebf5fefb558e50f496481616603862cb126af37b Mon Sep 17 00:00:00 2001 From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Wed, 30 Nov 2022 17:01:06 +0000 Subject: [PATCH] Make the keepalive stuff compile under macOS. --- rtsp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rtsp.c b/rtsp.c index c105ec0a..57d91061 100644 --- a/rtsp.c +++ b/rtsp.c @@ -5505,12 +5505,20 @@ void *rtsp_listen_loop(__attribute((unused)) void *arg) { int keepAliveCount = 5; // check this many times int keepAliveInterval = 5; // wait this many seconds between checks + #if defined COMPILE_FOR_BSD || defined COMPILE_FOR_OSX #define SOL_OPTION IPPROTO_TCP #else #define SOL_OPTION SOL_TCP #endif +#ifdef COMPILE_FOR_OSX + #define KEEP_ALIVE_OR_IDLE_OPTION TCP_KEEPALIVE +#else + #define KEEP_ALIVE_OR_IDLE_OPTION TCP_KEEPIDLE +#endif + + if (setsockopt(conn->fd, SOL_OPTION, TCP_KEEPIDLE, (void *)&keepAliveIdleTime, sizeof(keepAliveIdleTime))) { debug(1,"can't set the keepidle wait time"); } -- 2.47.3