Skip to content

Commit

Permalink
net/acceptor: Gracefully handle rustls error in run_accept_loop witho…
Browse files Browse the repository at this point in the history
…ut consuming it
  • Loading branch information
aggstam committed Oct 26, 2023
1 parent 60f9833 commit 51345a0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/net/acceptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,21 +174,21 @@ impl Acceptor {

// Handle ErrorKind::Other
Err(e) if e.kind() == ErrorKind::Other => {
if let Some(inner) = e.into_inner() {
if let Some(inner) = std::error::Error::source(&e) {
if let Some(inner) = inner.downcast_ref::<async_rustls::rustls::Error>() {
error!(
target: "net::acceptor::run_accept_loop()",
"[P2P] rustls listener error: {:?}", inner,
);
continue
}

error!(
target: "net::acceptor::run_accept_loop()",
"[P2P] Unhandled ErrorKind::Other error: {:?}", inner,
);
continue
}

error!(
target: "net::acceptor::run_accept_loop()",
"[P2P] Unhandled ErrorKind::Other error: {:?}", e,
);
return Err(e.into())
}

// Errors we didn't handle above:
Expand Down

0 comments on commit 51345a0

Please sign in to comment.