rama_net/
conn.rs

1//! Connection utilities
2
3use std::io;
4
5/// Check if the error is a connection error,
6/// in which case the error can be ignored.
7pub fn is_connection_error(e: &io::Error) -> bool {
8    matches!(
9        e.kind(),
10        io::ErrorKind::ConnectionRefused
11            | io::ErrorKind::ConnectionAborted
12            | io::ErrorKind::ConnectionReset
13            | io::ErrorKind::UnexpectedEof
14            | io::ErrorKind::NotConnected
15            | io::ErrorKind::BrokenPipe
16            | io::ErrorKind::Interrupted
17    )
18}