Fix build on macos
This commit is contained in:
parent
85446b93dd
commit
136d88451e
1 changed files with 5 additions and 0 deletions
|
@ -83,9 +83,14 @@ void server_base::accept_connection(const boost::system::error_code& error, sock
|
|||
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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue