From bfa1fdf3b36428c1885ee2f6ecea4c9bc4764466 Mon Sep 17 00:00:00 2001 From: George Hilliard Date: Sat, 13 Jun 2020 18:02:37 -0500 Subject: [PATCH] Add read timeout to Baichuan socket This might help with #13, although I remain unable to reproduce it exactly as described. --- src/bc_protocol/connection.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bc_protocol/connection.rs b/src/bc_protocol/connection.rs index 122e8c4..a3e9a80 100644 --- a/src/bc_protocol/connection.rs +++ b/src/bc_protocol/connection.rs @@ -160,6 +160,8 @@ fn connect_to(addr: SocketAddr, timeout: Duration) -> Result { }; socket.set_keepalive(Some(timeout))?; + socket.set_read_timeout(Some(timeout))?; + socket.set_write_timeout(Some(timeout))?; socket.connect_timeout(&addr.into(), timeout)?; Ok(socket.into_tcp_stream())