mirror of
https://github.com/mailscope/kumomta.git
synced 2026-08-20 19:38:18 +00:00
proxy: refine error reporting a little bit more
This commit is contained in:
@@ -49,7 +49,14 @@ async fn start_listener(endpoint: &str, timeout: std::time::Duration) -> anyhow:
|
||||
|
||||
tokio::spawn(async move {
|
||||
loop {
|
||||
let (socket, peer_address) = listener.accept().await.context("accepting connection")?;
|
||||
let (socket, peer_address) = match listener.accept().await {
|
||||
Ok(tuple) => tuple,
|
||||
Err(err) => {
|
||||
log::error!("accept failed: {err:#}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
tokio::spawn(async move {
|
||||
if let Err(err) =
|
||||
proxy_handler::handle_proxy_client(socket, peer_address, timeout).await
|
||||
@@ -58,9 +65,6 @@ async fn start_listener(endpoint: &str, timeout: std::time::Duration) -> anyhow:
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[allow(unreachable_code)]
|
||||
anyhow::Result::<()>::Ok(())
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -64,7 +64,10 @@ pub async fn handle_proxy_client(
|
||||
{
|
||||
Err(_) => RequestStatus::timeout(),
|
||||
Ok(Ok(s)) => s,
|
||||
Ok(Err(err)) => RequestStatus::error(err),
|
||||
Ok(Err(err)) => {
|
||||
log::error!("peer={peer_address:?}: {state:?} {request:?} -> {err:#}");
|
||||
RequestStatus::error(err)
|
||||
}
|
||||
};
|
||||
|
||||
// socks5 crate doesn't believe in allowing cloning, so we premptively debug
|
||||
|
||||
Reference in New Issue
Block a user