Files
Thomas Leonard 5081e00b2c Also configure TCP keep-alives for incoming connections
This is needed when the client machine crashes without resetting the
connection.
2021-04-20 18:34:29 +01:00

9 lines
256 B
OCaml

let have_tcp_keepidle =
try ExtUnix.All.have_sockopt_int ExtUnix.All.TCP_KEEPIDLE
with ExtUnix.All.Not_available _ -> false
let try_set_idle socket i =
if have_tcp_keepidle then (
ExtUnix.All.setsockopt_int socket ExtUnix.All.TCP_KEEPIDLE i
)