From b3733934df48976d78985da1970d6c28e8c96dfc Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Thu, 6 Aug 2020 12:45:14 +0200 Subject: [PATCH] TCP_KEEPIDLE is not available everywhere (e.g. not in OSX) --- lib/MySQL_Thread.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index db10dd809..5675e1feb 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -3833,10 +3833,12 @@ MySQL_Session * MySQL_Thread::create_new_session_and_client_data_stream(int _fd) if (mysql_thread___use_tcp_keepalive) { setsockopt(sess->client_myds->fd, SOL_SOCKET, SO_KEEPALIVE, (char *) &arg_on, sizeof(arg_on)); +#ifdef TCP_KEEPIDLE if (mysql_thread___tcp_keepalive_time > 0) { int keepalive_time = mysql_thread___tcp_keepalive_time; setsockopt(sess->client_myds->fd, IPPROTO_TCP, TCP_KEEPIDLE, (char *) &keepalive_time, sizeof(keepalive_time)); } +#endif } #ifdef __APPLE__