diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index e122e74..b6b98c9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -145,6 +145,9 @@ fn handle_conn_check( raddr: SocketAddr, inbound_healthy: &mut bool, ) -> io::Result<()> { + conn.set_read_timeout(Some(TCP_TIMEOUT))?; + conn.set_write_timeout(Some(TCP_TIMEOUT))?; + let mut buf = [0; 4]; loop { match conn.read_exact(&mut buf) { @@ -167,6 +170,9 @@ fn handle_conn_check( } fn handle_conn_monitor(mut conn: TcpStream, raddr: SocketAddr) -> io::Result<()> { + conn.set_read_timeout(Some(TCP_TIMEOUT))?; + conn.set_write_timeout(Some(TCP_TIMEOUT))?; + let mut buf = [0; 4]; loop { match conn.read_exact(&mut buf) { @@ -205,6 +211,8 @@ fn check_connectivity( if let Some(mut conn4) = conn4 { conn4.write_all(b"GET / HTTP/1.1")?; + conn4.set_read_timeout(Some(TCP_TIMEOUT))?; + conn4.set_write_timeout(Some(TCP_TIMEOUT))?; loop { match conn4.read(&mut buf) { @@ -239,6 +247,8 @@ fn check_connectivity( if let Some(mut conn6) = conn6 { conn6.write_all(b"GET / HTTP/1.1")?; + conn6.set_read_timeout(Some(TCP_TIMEOUT))?; + conn6.set_write_timeout(Some(TCP_TIMEOUT))?; loop { match conn6.read(&mut buf) { |