File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,17 @@ fn connect_error() {
46
46
}
47
47
}
48
48
49
+ #[ test]
50
+ #[ cfg_attr( target_env = "sgx" , ignore) ] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
51
+ fn connect_timeout_error ( ) {
52
+ let socket_addr = next_test_ip4 ( ) ;
53
+ let result = TcpStream :: connect_timeout ( & socket_addr, Duration :: MAX ) ;
54
+ assert ! ( !matches!( result, Err ( e) if e. kind( ) == ErrorKind :: TimedOut ) ) ;
55
+
56
+ let _listener = TcpListener :: bind ( & socket_addr) . unwrap ( ) ;
57
+ assert ! ( TcpStream :: connect_timeout( & socket_addr, Duration :: MAX ) . is_ok( ) ) ;
58
+ }
59
+
49
60
#[ test]
50
61
fn listen_localhost ( ) {
51
62
let socket_addr = next_test_ip4 ( ) ;
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ impl Socket {
159
159
}
160
160
161
161
let mut timeout = c:: timeval {
162
- tv_sec : timeout. as_secs ( ) as c_long ,
162
+ tv_sec : cmp :: min ( timeout. as_secs ( ) , c_long :: MAX as u64 ) as c_long ,
163
163
tv_usec : ( timeout. subsec_nanos ( ) / 1000 ) as c_long ,
164
164
} ;
165
165
You can’t perform that action at this time.
0 commit comments