expand match

This commit is contained in:
Bastian Gruber 2023-05-03 07:35:44 +02:00
parent 47786912c8
commit 5122ef3fe8
No known key found for this signature in database
GPG key ID: BE9F8C772B188CBF

View file

@ -52,28 +52,38 @@ pub async fn handle_request(socket: TcpStream, upstream: TcpStream) -> Result<()
loop { loop {
tokio::select! { tokio::select! {
Some(response) = framed_client_read.next() => { res = framed_client_read.next() => {
match response { match res {
Ok(message) => { Some(response) => {
info!("Send upstream: {message}"); match response {
let _ = framed_server_write.send(replace_address(message)).await; Ok(message) => {
} info!("Send upstream: {message}");
Err(err) => { let _ = framed_server_write.send(replace_address(message)).await;
error!("Error reading from client: {err}"); }
return Err(err.into()); Err(err) => {
error!("Error reading from client: {err}");
return Err(err.into());
}
}
} }
None => return Ok(())
} }
} }
Some(response) = farmed_server_read.next() => { res = farmed_server_read.next() => {
match response { match res {
Ok(message) => { Some(response) => {
info!("Send to client: {message}"); match response {
let _ = framed_client_write.send(replace_address(message)).await; Ok(message) => {
} info!("Send to client: {message}");
Err(err) => { let _ = framed_client_write.send(replace_address(message)).await;
error!("Error reading from server: {err}"); }
return Err(err.into()); Err(err) => {
error!("Error reading from server: {err}");
return Err(err.into());
}
}
} }
None => return Ok(())
} }
} }
} }