File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Expand file tree Collapse file tree 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] {
184184 }
185185}
186186
187- #[ cfg( test) ]
187+ // cannot give tcp/ip permission without help of apk
188+ #[ cfg( test, not( target_os="android" ) ) ]
188189mod test {
189190 use std:: io:: net:: ip:: { SocketAddr , Ipv4Addr } ;
190191 use super :: * ;
191192 use super :: super :: local_loop;
192193
193194 #[ test]
194- #[ ignore( cfg( target_os="android" ) ) ] // cannot give tcp/ip permission without help of apk
195195 fn getaddrinfo_test ( ) {
196196 match GetAddrInfoRequest :: run ( local_loop ( ) , Some ( "localhost" ) , None , None ) {
197197 Ok ( infos) => {
@@ -208,4 +208,12 @@ mod test {
208208 Err ( e) => fail ! ( "{:?}" , e) ,
209209 }
210210 }
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+ }
211219}
Original file line number Diff line number Diff line change @@ -59,12 +59,17 @@ pub fn sockaddr_to_socket_addr(addr: *sockaddr) -> SocketAddr {
5959 fail ! ( "unknown address?" ) ;
6060 } ;
6161 let ip_name = {
62+ // apparently there's an off-by-one in libuv?
63+ let ip_size = ip_size + 1 ;
6264 let buf = vec:: from_elem ( ip_size + 1 /*null terminated*/ , 0u8 ) ;
6365 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 )
6668 } 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( ) ) ;
6873 }
6974 buf
7075 } ;
You can’t perform that action at this time.
0 commit comments