MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / is_benign_close

Function is_benign_close

crates/openshell-supervisor-network/src/l7/rest.rs:2395–2402  ·  view source on GitHub ↗

Check if an IO error represents a benign connection close. TLS peers commonly close the socket without sending a `close_notify` alert. Rustls reports this as `UnexpectedEof`, but it's functionally equivalent to a clean close when no request data has been received yet.

(err: &std::io::Error)

Source from the content-addressed store, hash-verified

2393/// Rustls reports this as `UnexpectedEof`, but it's functionally equivalent
2394/// to a clean close when no request data has been received yet.
2395fn is_benign_close(err: &std::io::Error) -> bool {
2396 matches!(
2397 err.kind(),
2398 std::io::ErrorKind::UnexpectedEof
2399 | std::io::ErrorKind::ConnectionReset
2400 | std::io::ErrorKind::BrokenPipe
2401 )
2402}
2403
2404#[cfg(test)]
2405#[allow(

Callers 1

parse_http_requestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected