@@ -933,17 +933,15 @@ mod tests {
933933 let listener = t ! ( TcpListener :: bind( & addr) ) ;
934934
935935 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 ) ) ) ) ;
937937
938938 let mut buf = [ 0 ; 10 ] ;
939939 let wait = Duration :: span ( || {
940940 let kind = stream. read ( & mut buf) . err ( ) . expect ( "expected error" ) . kind ( ) ;
941941 assert ! ( kind == ErrorKind :: WouldBlock || kind == ErrorKind :: TimedOut ) ;
942942 } ) ;
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 ) ) ;
947945 }
948946
949947 #[ test]
@@ -952,7 +950,7 @@ mod tests {
952950 let listener = t ! ( TcpListener :: bind( & addr) ) ;
953951
954952 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 ) ) ) ) ;
956954
957955 let mut other_end = t ! ( listener. accept( ) ) . 0 ;
958956 t ! ( other_end. write_all( b"hello world" ) ) ;
@@ -965,9 +963,7 @@ mod tests {
965963 let kind = stream. read ( & mut buf) . err ( ) . expect ( "expected error" ) . kind ( ) ;
966964 assert ! ( kind == ErrorKind :: WouldBlock || kind == ErrorKind :: TimedOut ) ;
967965 } ) ;
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 ) ) ;
972968 }
973969}
0 commit comments