File tree 2 files changed +18
-5
lines changed
2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -184,14 +184,14 @@ pub fn accum_addrinfo(addr: &Addrinfo) -> ~[ai::Info] {
184
184
}
185
185
}
186
186
187
- #[ cfg( test) ]
187
+ // cannot give tcp/ip permission without help of apk
188
+ #[ cfg( test, not( target_os="android" ) ) ]
188
189
mod test {
189
190
use std:: io:: net:: ip:: { SocketAddr , Ipv4Addr } ;
190
191
use super :: * ;
191
192
use super :: super :: local_loop;
192
193
193
194
#[ test]
194
- #[ ignore( cfg( target_os="android" ) ) ] // cannot give tcp/ip permission without help of apk
195
195
fn getaddrinfo_test ( ) {
196
196
match GetAddrInfoRequest :: run ( local_loop ( ) , Some ( "localhost" ) , None , None ) {
197
197
Ok ( infos) => {
@@ -208,4 +208,12 @@ mod test {
208
208
Err ( e) => fail ! ( "{:?}" , e) ,
209
209
}
210
210
}
211
+
212
+ #[ test]
213
+ fn issue_10663 ( ) {
214
+ // Something should happen here, but this certainly shouldn't cause
215
+ // everything to die. The actual outcome we don't care too much about.
216
+ GetAddrInfoRequest :: run ( local_loop ( ) , Some ( "irc.n0v4.com" ) , None ,
217
+ None ) ;
218
+ }
211
219
}
Original file line number Diff line number Diff line change @@ -59,12 +59,17 @@ pub fn sockaddr_to_socket_addr(addr: *sockaddr) -> SocketAddr {
59
59
fail ! ( "unknown address?" ) ;
60
60
} ;
61
61
let ip_name = {
62
+ // apparently there's an off-by-one in libuv?
63
+ let ip_size = ip_size + 1 ;
62
64
let buf = vec:: from_elem ( ip_size + 1 /*null terminated*/ , 0u8 ) ;
63
65
let buf_ptr = vec:: raw:: to_ptr ( buf) ;
64
- if uvll:: rust_is_ipv4_sockaddr ( addr) == 1 {
65
- uvll:: uv_ip4_name ( addr, buf_ptr as * c_char , ip_size as size_t ) ;
66
+ let ret = if uvll:: rust_is_ipv4_sockaddr ( addr) == 1 {
67
+ uvll:: uv_ip4_name ( addr, buf_ptr as * c_char , ip_size as size_t )
66
68
} else {
67
- uvll:: uv_ip6_name ( addr, buf_ptr as * c_char , ip_size as size_t ) ;
69
+ uvll:: uv_ip6_name ( addr, buf_ptr as * c_char , ip_size as size_t )
70
+ } ;
71
+ if ret != 0 {
72
+ fail ! ( "error parsing sockaddr: {}" , UvError ( ret) . desc( ) ) ;
68
73
}
69
74
buf
70
75
} ;
You can’t perform that action at this time.
0 commit comments