File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -883,11 +883,23 @@ mod tests {
883
883
884
884
#[ test]
885
885
fn set_nonblocking ( ) {
886
- let addr = next_test_ip4 ( ) ;
886
+ each_ip ( & mut |addr, _| {
887
+ let socket = t ! ( UdpSocket :: bind( & addr) ) ;
887
888
888
- let stream = t ! ( UdpSocket :: bind( & addr) ) ;
889
+ t ! ( socket. set_nonblocking( true ) ) ;
890
+ t ! ( socket. set_nonblocking( false ) ) ;
891
+
892
+ t ! ( socket. connect( addr) ) ;
889
893
890
- t ! ( stream. set_nonblocking( true ) ) ;
891
- t ! ( stream. set_nonblocking( false ) ) ;
894
+ t ! ( socket. set_nonblocking( false ) ) ;
895
+ t ! ( socket. set_nonblocking( true ) ) ;
896
+
897
+ let mut buf = [ 0 ] ;
898
+ match socket. recv ( & mut buf) {
899
+ Ok ( _) => panic ! ( "expected error" ) ,
900
+ Err ( ref e) if e. kind ( ) == ErrorKind :: WouldBlock => { }
901
+ Err ( e) => panic ! ( "unexpected error {}" , e) ,
902
+ }
903
+ } )
892
904
}
893
905
}
You can’t perform that action at this time.
0 commit comments