@@ -933,17 +933,15 @@ mod tests {
933
933
let listener = t ! ( TcpListener :: bind( & addr) ) ;
934
934
935
935
let mut stream = t ! ( TcpStream :: connect( & ( "localhost" , addr. port( ) ) ) ) ;
936
- t ! ( stream. set_read_timeout( Some ( Duration :: from_millis( 10 ) ) ) ) ;
936
+ t ! ( stream. set_read_timeout( Some ( Duration :: from_millis( 1000 ) ) ) ) ;
937
937
938
938
let mut buf = [ 0 ; 10 ] ;
939
939
let wait = Duration :: span ( || {
940
940
let kind = stream. read ( & mut buf) . err ( ) . expect ( "expected error" ) . kind ( ) ;
941
941
assert ! ( kind == ErrorKind :: WouldBlock || kind == ErrorKind :: TimedOut ) ;
942
942
} ) ;
943
- assert ! ( wait > Duration :: from_millis( 5 ) ) ;
944
- // windows will sometimes extend this by ~500ms, so we'll just take the
945
- // fact that we did time out as a win :(
946
- assert ! ( cfg!( windows) || wait < Duration :: from_millis( 15 ) ) ;
943
+ assert ! ( wait > Duration :: from_millis( 400 ) ) ;
944
+ assert ! ( wait < Duration :: from_millis( 1600 ) ) ;
947
945
}
948
946
949
947
#[ test]
@@ -952,7 +950,7 @@ mod tests {
952
950
let listener = t ! ( TcpListener :: bind( & addr) ) ;
953
951
954
952
let mut stream = t ! ( TcpStream :: connect( & ( "localhost" , addr. port( ) ) ) ) ;
955
- t ! ( stream. set_read_timeout( Some ( Duration :: from_millis( 10 ) ) ) ) ;
953
+ t ! ( stream. set_read_timeout( Some ( Duration :: from_millis( 1000 ) ) ) ) ;
956
954
957
955
let mut other_end = t ! ( listener. accept( ) ) . 0 ;
958
956
t ! ( other_end. write_all( b"hello world" ) ) ;
@@ -965,9 +963,7 @@ mod tests {
965
963
let kind = stream. read ( & mut buf) . err ( ) . expect ( "expected error" ) . kind ( ) ;
966
964
assert ! ( kind == ErrorKind :: WouldBlock || kind == ErrorKind :: TimedOut ) ;
967
965
} ) ;
968
- assert ! ( wait > Duration :: from_millis( 5 ) ) ;
969
- // windows will sometimes extend this by ~500ms, so we'll just take the
970
- // fact that we did time out as a win :(
971
- assert ! ( cfg!( windows) || wait < Duration :: from_millis( 15 ) ) ;
966
+ assert ! ( wait > Duration :: from_millis( 400 ) ) ;
967
+ assert ! ( wait < Duration :: from_millis( 1600 ) ) ;
972
968
}
973
969
}
0 commit comments