fix: Avoid stopping accepting new connection on error
This commit is contained in:
parent
450d76aaed
commit
94d9a14c81
2 changed files with 10 additions and 2 deletions
|
@ -63,7 +63,15 @@ where
|
||||||
W: AsyncWrite + Send + 'static,
|
W: AsyncWrite + Send + 'static,
|
||||||
{
|
{
|
||||||
pin_mut!(incoming_cnx);
|
pin_mut!(incoming_cnx);
|
||||||
while let Some(Ok((cnx_stream, remote_addr))) = incoming_cnx.next().await {
|
while let Some(cnx) = incoming_cnx.next().await {
|
||||||
|
let (cnx_stream, remote_addr) = match cnx {
|
||||||
|
Ok((cnx_stream, remote_addr)) => (cnx_stream, remote_addr),
|
||||||
|
Err(err) => {
|
||||||
|
error!("Error accepting connection: {:?}", err);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let request_id = Uuid::now_v7();
|
let request_id = Uuid::now_v7();
|
||||||
let span = span!(
|
let span = span!(
|
||||||
Level::INFO,
|
Level::INFO,
|
||||||
|
|
|
@ -205,7 +205,7 @@ where
|
||||||
None => break,
|
None => break,
|
||||||
Some(Err(err)) => {
|
Some(Err(err)) => {
|
||||||
warn!("Error while listening for incoming connections {err:?}");
|
warn!("Error while listening for incoming connections {err:?}");
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
Some(Ok(cnx)) => {
|
Some(Ok(cnx)) => {
|
||||||
if tx.send_timeout(cnx, Duration::from_secs(30)).await.is_err() {
|
if tx.send_timeout(cnx, Duration::from_secs(30)).await.is_err() {
|
||||||
|
|
Loading…
Reference in a new issue