Break reading loop as soon as client closes the connection

This commit is contained in:
Bastian Gruber 2023-05-03 08:19:25 +02:00
parent 9c77c7f5d7
commit d6118657a8
No known key found for this signature in database
GPG key ID: BE9F8C772B188CBF

View file

@ -69,7 +69,7 @@ pub async fn handle_request(socket: TcpStream, upstream: TcpStream) -> Result<()
} }
None => { None => {
info!("Client closed the connection"); info!("Client closed the connection");
return Ok(()) break;
} }
} }
} }
@ -90,12 +90,14 @@ pub async fn handle_request(socket: TcpStream, upstream: TcpStream) -> Result<()
} }
None => { None => {
info!("Server closed the connection"); info!("Server closed the connection");
return Ok(()) break;
} }
} }
} }
} }
} }
Ok(())
} }
fn replace_address(message: String) -> String { fn replace_address(message: String) -> String {