This commit is contained in:
parent
c09bc6fe36
commit
6e17c3a6c7
21
src/main.rs
21
src/main.rs
@ -117,7 +117,9 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
log::info!("Got a new client read {count}");
|
||||
|
||||
if count == 0 {
|
||||
log::warn!("infinite loop");
|
||||
log::warn!("infinite loop (client)");
|
||||
drop(client_write);
|
||||
drop(upstream);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -135,10 +137,21 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
}
|
||||
|
||||
count = upstream.read(&mut buf_server) => {
|
||||
let count = match count{ Ok(count) => count,Err(e) => {
|
||||
log::error!("Failed to read from upstream! {e}");
|
||||
let count = match count {
|
||||
Ok(count) => count,
|
||||
Err(e) => {
|
||||
log::error!("Failed to read from upstream! {e}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if count == 0 {
|
||||
log::warn!("infinite loop (upstream)");
|
||||
drop(client_write);
|
||||
drop(upstream);
|
||||
return;
|
||||
}};
|
||||
}
|
||||
|
||||
log::info!("Got a new upstream read {count}");
|
||||
client_write.write_all(&buf_server[..count]).await.expect("Failed to write to client");
|
||||
res_file.write_all(&buf_server[..count]).expect("Failed to write to res");
|
||||
|
Loading…
x
Reference in New Issue
Block a user