proxy: "continue on error" for the accept call, too

as this gets rid of 2 levels of indentation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-05-11 15:53:55 +02:00 committed by Thomas Lamprecht
parent a5e3be4992
commit cc269b9ff9

View File

@ -196,11 +196,14 @@ async fn accept_connection(
let accept_counter = Arc::new(()); let accept_counter = Arc::new(());
loop { loop {
match listener.accept().await { let (sock, _addr) = match listener.accept().await {
Ok(conn) => conn,
Err(err) => { Err(err) => {
eprintln!("error accepting tcp connection: {}", err); eprintln!("error accepting tcp connection: {}", err);
continue;
} }
Ok((sock, _addr)) => { };
sock.set_nodelay(true).unwrap(); sock.set_nodelay(true).unwrap();
let _ = set_tcp_keepalive(sock.as_raw_fd(), PROXMOX_BACKUP_TCP_KEEPALIVE_TIME); let _ = set_tcp_keepalive(sock.as_raw_fd(), PROXMOX_BACKUP_TCP_KEEPALIVE_TIME);
let acceptor = Arc::clone(&acceptor); let acceptor = Arc::clone(&acceptor);
@ -256,8 +259,6 @@ async fn accept_connection(
drop(accept_counter); // decrease reference count drop(accept_counter); // decrease reference count
}); });
} }
}
}
} }
fn start_stat_generator() { fn start_stat_generator() {