Skip to content

Commit

Permalink
Fix build on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
loonycyborg committed Jan 30, 2019
1 parent 89856d6 commit 061c2f0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/server/server_base.cpp
Expand Up @@ -97,9 +97,14 @@ void server_base::accept_connection(boost::asio::ip::tcp::acceptor& acceptor, co
int timeout = 30;
int cnt = 10;
int interval = 30;
#ifdef __linux__
setsockopt(socket->native_handle(), SOL_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout));
setsockopt(socket->native_handle(), SOL_TCP, TCP_KEEPCNT, &cnt, sizeof(cnt));
setsockopt(socket->native_handle(), SOL_TCP, TCP_KEEPINTVL, &interval, sizeof(interval));
#endif
#if defined(__APPLE__) && defined(__MACH__)
setsockopt(socket->native_handle(), IPPROTO_TCP, TCP_KEEPALIVE, &timeout, sizeof(timeout));
#endif
}
#endif

Expand Down

0 comments on commit 061c2f0

Please sign in to comment.