continue if accept fails
This commit is contained in:
parent
0eed949a27
commit
02f44cfab6
21
src/main.rs
21
src/main.rs
@ -350,13 +350,22 @@ async fn tokio_main(config: Arc<Config>) -> eyre::Result<()> {
|
||||
"centralex server listening"
|
||||
);
|
||||
|
||||
while let Ok((stream, addr)) = listener.accept().await {
|
||||
info!(%addr, "new connection");
|
||||
loop {
|
||||
let connection = listener.accept().await;
|
||||
|
||||
spawn(
|
||||
&format!("connection to {addr}"),
|
||||
connection_handler(stream, addr, config.clone(), port_handler.clone()),
|
||||
);
|
||||
match connection {
|
||||
Ok((stream, addr)) => {
|
||||
info!(%addr, "new connection");
|
||||
|
||||
spawn(
|
||||
&format!("connection to {addr}"),
|
||||
connection_handler(stream, addr, config.clone(), port_handler.clone()),
|
||||
);
|
||||
}
|
||||
Err(err) => {
|
||||
error!(%err, "failed to accept connection");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user