Make the keepalive stuff compile under macOS.

This commit is contained in:
Mike Brady
2022-11-30 17:01:06 +00:00
parent 5f3f238b48
commit ebf5fefb55
+8
View File
@@ -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");
}