mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-30 00:00:16 +02:00
make errno assertion less flaky
This commit is contained in:
+12
-11
@@ -406,16 +406,17 @@ async fn epollhup() -> io::Result<()> {
|
|||||||
drop(listener);
|
drop(listener);
|
||||||
|
|
||||||
let err = connect.await.unwrap_err();
|
let err = connect.await.unwrap_err();
|
||||||
|
let errno = err.kind();
|
||||||
// On illumos (and presumably other Solaris descendents), `connect(3SOCKET)`
|
assert!(
|
||||||
// returns `ECONNREFUSED` here rather than `ECONNRESET`.
|
// As far as I can tell, whether we see ECONNREFUSED or ECONNRESET here
|
||||||
//
|
// seems relatively inconsistent, at least on non-Linux operating
|
||||||
// See: https://illumos.org/man/3SOCKET/connect
|
// systems. The difference in meaning between these errnos is not
|
||||||
let expected_errno = if cfg!(target_os = "illumos") || cfg!(target_os = "solaris") {
|
// particularly well-defined, so let's just accept either.
|
||||||
io::ErrorKind::ConnectionRefused
|
matches!(
|
||||||
} else {
|
errno,
|
||||||
io::ErrorKind::ConnectionReset
|
io::ErrorKind::ConnectionRefused | io::ErrorKind::ConnectionReset
|
||||||
};
|
),
|
||||||
assert_eq!(err.kind(), expected_errno);
|
"unexpected error kind: {errno:?} (expected ConnectionRefused or ConnectionReset)"
|
||||||
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user