Skip to content

Commit

Permalink
Both TCP keepalive options could be defined.
Browse files Browse the repository at this point in the history
Both TCP_KEEPIDLE and TCP_KEEPALIVE could be defined at the same time.
It shouldn't break build

Change-Id: Ic8775128f241d7219ee4fc67d74c7c2f3f8c7491
Closes-Bug: #1795688
  • Loading branch information
magdalena-zaremba committed Oct 2, 2018
1 parent e3be926 commit 015371b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions io/tcp_session.cc
Expand Up @@ -795,8 +795,7 @@ error_code TcpSession::SetSocketKeepaliveOptions(int keepalive_time,
"keepalive_idle_time: " << keepalive_time << " set error: " << ec);
return ec;
}
#endif
#ifdef TCP_KEEPALIVE
#elif TCP_KEEPALIVE
typedef integer< IPPROTO_TCP, TCP_KEEPALIVE > keepalive_idle_time;
keepalive_idle_time keepalive_idle_time_option(keepalive_time);
socket()->set_option(keepalive_idle_time_option, ec);
Expand All @@ -805,6 +804,8 @@ error_code TcpSession::SetSocketKeepaliveOptions(int keepalive_time,
"keepalive_idle_time: " << keepalive_time << " set error: " << ec);
return ec;
}
#else
#error No TCP keepalive option defined.
#endif
// TCP_KEEPCNT and TCP_KEEPINTVL are not supported on windows. But boost tries to set them, causing
// an exception. See:
Expand Down

0 comments on commit 015371b

Please sign in to comment.