Peer - Connection closed fixes

This commit is contained in:
Alexey 2026-02-21 13:56:24 +03:00
parent 8d93695194
commit c3ebb42120
No known key found for this signature in database
1 changed files with 37 additions and 1 deletions

View File

@ -938,7 +938,43 @@ match crate::transport::middle_proxy::fetch_proxy_secret(proxy_secret_path).awai
.run() .run()
.await .await
{ {
warn!(peer = %peer_addr, error = %e, "Connection closed with error"); let peer_closed = match &e {
crate::error::ProxyError::Io(ioe) => {
matches!(
ioe.kind(),
std::io::ErrorKind::ConnectionReset
| std::io::ErrorKind::ConnectionAborted
| std::io::ErrorKind::BrokenPipe
| std::io::ErrorKind::NotConnected
)
}
crate::error::ProxyError::Stream(
crate::error::StreamError::Io(ioe),
) => {
matches!(
ioe.kind(),
std::io::ErrorKind::ConnectionReset
| std::io::ErrorKind::ConnectionAborted
| std::io::ErrorKind::BrokenPipe
| std::io::ErrorKind::NotConnected
)
}
_ => false,
};
if peer_closed {
debug!(
peer = %peer_addr,
error = %e,
"Connection closed by peer"
);
} else {
warn!(
peer = %peer_addr,
error = %e,
"Connection closed with error"
);
}
} }
}); });
} }