File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -406,16 +406,17 @@ async fn epollhup() -> io::Result<()> {
406
406
drop ( listener) ;
407
407
408
408
let err = connect. await . unwrap_err ( ) ;
409
-
410
- // On illumos (and presumably other Solaris descendents), `connect(3SOCKET)`
411
- // returns `ECONNREFUSED` here rather than `ECONNRESET`.
412
- //
413
- // See: https://illumos.org/man/3SOCKET/connect
414
- let expected_errno = if cfg ! ( target_os = "illumos" ) || cfg ! ( target_os = "solaris" ) {
415
- io:: ErrorKind :: ConnectionRefused
416
- } else {
417
- io:: ErrorKind :: ConnectionReset
418
- } ;
419
- assert_eq ! ( err. kind( ) , expected_errno) ;
409
+ let errno = err. kind ( ) ;
410
+ assert ! (
411
+ // As far as I can tell, whether we see ECONNREFUSED or ECONNRESET here
412
+ // seems relatively inconsistent, at least on non-Linux operating
413
+ // systems. The difference in meaning between these errnos is not
414
+ // particularly well-defined, so let's just accept either.
415
+ matches!(
416
+ errno,
417
+ io:: ErrorKind :: ConnectionRefused | io:: ErrorKind :: ConnectionReset
418
+ ) ,
419
+ "unexpected error kind: {errno:?} (expected ConnectionRefused or ConnectionReset)"
420
+ ) ;
420
421
Ok ( ( ) )
421
422
}
You can’t perform that action at this time.
0 commit comments