Cygwin: tcp: Support TCP_KEEPIDLE, TCP_KEEPCNT, TCP_KEEPINTVL

Use WSAIoctl(SIO_KEEPALIVE_VALS) on older systems.

Make sure that keep-alive timeout is equivalent to
TCP_KEEPIDLE + TCP_KEEPCNT * TCP_KEEPINTVL on older systems,
even with TCP_KEEPCNT being a fixed value on those systems.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2020-07-01 20:27:10 +02:00
parent 0feb77c260
commit 8ccffddc91
5 changed files with 180 additions and 14 deletions

View File

@ -720,6 +720,11 @@ class fhandler_socket_inet: public fhandler_socket_wsock
private:
bool oobinline; /* True if option SO_OOBINLINE is set */
bool tcp_fastopen; /* True if TCP_FASTOPEN is set on older systems */
int tcp_keepidle; /* TCP_KEEPIDLE value in secs on older systems */
int tcp_keepcnt; /* TCP_KEEPCNT value on older systems */
int tcp_keepintvl; /* TCP_KEEPINTVL value in secs on older systems */
int set_keepalive (int keepidle, int keepcnt, int keepintvl);
protected:
int af_local_connect () { return 0; }