From 5439f45eabe8d82fd2b7589259f62f82067bde97 Mon Sep 17 00:00:00 2001 From: George Hilliard Date: Mon, 11 May 2020 22:09:32 -0500 Subject: [PATCH] Enable TCP keepalive on Baichuan connections More help for #6 on GitHub. Can't reproduce the exact issue, but there are several related ones. --- src/bc_protocol/connection.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bc_protocol/connection.rs b/src/bc_protocol/connection.rs index 29bda8e..2fade7d 100644 --- a/src/bc_protocol/connection.rs +++ b/src/bc_protocol/connection.rs @@ -153,6 +153,7 @@ fn connect_to(addr: SocketAddr, timeout: Duration) -> Result { } }; + socket.set_keepalive(Some(timeout))?; socket.connect_timeout(&addr.into(), timeout)?; Ok(socket.into_tcp_stream())