std: whitespace/comment clean
This commit is contained in:
parent
61cc8a07f8
commit
5014a2a413
3 changed files with 14 additions and 29 deletions
|
@ -84,7 +84,6 @@ crust fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
|
||||||
if status == 0i32 {
|
if status == 0i32 {
|
||||||
if res != (ptr::null::<addrinfo>()) {
|
if res != (ptr::null::<addrinfo>()) {
|
||||||
let mut out_vec = [];
|
let mut out_vec = [];
|
||||||
let mut addr_strings = [];
|
|
||||||
log(debug, #fmt("initial addrinfo: %?", res));
|
log(debug, #fmt("initial addrinfo: %?", res));
|
||||||
let mut curr_addr = res;
|
let mut curr_addr = res;
|
||||||
loop {
|
loop {
|
||||||
|
@ -96,17 +95,6 @@ crust fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
|
||||||
ipv6(copy((
|
ipv6(copy((
|
||||||
*ll::addrinfo_as_sockaddr_in6(curr_addr))))
|
*ll::addrinfo_as_sockaddr_in6(curr_addr))))
|
||||||
};
|
};
|
||||||
// we're doing this check to avoid adding multiple
|
|
||||||
// ip_addrs to the out_vec that are duplicates.. on
|
|
||||||
// 64bit unbuntu a call to uv_getaddrinfo against
|
|
||||||
// localhost seems to return three addrinfos, all
|
|
||||||
// distinct (by ptr addr), that are all ipv4
|
|
||||||
// addresses and all point to 127.0.0.1
|
|
||||||
let addr_str = format_addr(new_ip_addr);
|
|
||||||
if !vec::contains(addr_strings, addr_str) {
|
|
||||||
addr_strings += [addr_str];
|
|
||||||
out_vec += [new_ip_addr];
|
|
||||||
}
|
|
||||||
|
|
||||||
let next_addr = ll::get_next_addrinfo(curr_addr);
|
let next_addr = ll::get_next_addrinfo(curr_addr);
|
||||||
if next_addr == ptr::null::<addrinfo>() as *addrinfo {
|
if next_addr == ptr::null::<addrinfo>() as *addrinfo {
|
||||||
|
|
|
@ -7,7 +7,8 @@ import uv::iotask;
|
||||||
import uv::iotask::iotask;
|
import uv::iotask::iotask;
|
||||||
import comm::methods;
|
import comm::methods;
|
||||||
import future_spawn = future::spawn;
|
import future_spawn = future::spawn;
|
||||||
// FIXME: should be able to replace w/ result::{result, extensions};
|
// FIXME #1935
|
||||||
|
// should be able to, but can't atm, replace w/ result::{result, extensions};
|
||||||
import result::*;
|
import result::*;
|
||||||
import libc::size_t;
|
import libc::size_t;
|
||||||
import str::extensions;
|
import str::extensions;
|
||||||
|
@ -589,7 +590,7 @@ fn listen_common(-host_ip: ip::ip_addr, port: uint, backlog: uint,
|
||||||
let server_data_ptr = ptr::addr_of(server_data);
|
let server_data_ptr = ptr::addr_of(server_data);
|
||||||
|
|
||||||
let setup_result = comm::listen {|setup_ch|
|
let setup_result = comm::listen {|setup_ch|
|
||||||
// FIXME this is to address a compiler warning about
|
// this is to address a compiler warning about
|
||||||
// an implicit copy.. it seems that double nested
|
// an implicit copy.. it seems that double nested
|
||||||
// will defeat a move sigil, as is done to the host_ip
|
// will defeat a move sigil, as is done to the host_ip
|
||||||
// arg above.. this same pattern works w/o complaint in
|
// arg above.. this same pattern works w/o complaint in
|
||||||
|
@ -1239,9 +1240,6 @@ mod test {
|
||||||
impl_gl_tcp_ipv4_server_address_in_use();
|
impl_gl_tcp_ipv4_server_address_in_use();
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
// FIXME: this probably needs to be ignored on windows.
|
|
||||||
// ... need to verify (someday we'll have 64bit windows! :)
|
|
||||||
//#[ignore(cfg(target_os = "win32"))]
|
|
||||||
fn test_gl_tcp_server_access_denied() unsafe {
|
fn test_gl_tcp_server_access_denied() unsafe {
|
||||||
impl_gl_tcp_ipv4_server_access_denied();
|
impl_gl_tcp_ipv4_server_access_denied();
|
||||||
}
|
}
|
||||||
|
@ -1270,9 +1268,6 @@ mod test {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore(cfg(target_os = "linux"))]
|
#[ignore(cfg(target_os = "linux"))]
|
||||||
// FIXME: this probably needs to be ignored on windows.
|
|
||||||
// ... need to verify
|
|
||||||
//#[ignore(cfg(target_os = "win32"))]
|
|
||||||
fn test_gl_tcp_server_access_denied() unsafe {
|
fn test_gl_tcp_server_access_denied() unsafe {
|
||||||
impl_gl_tcp_ipv4_server_access_denied();
|
impl_gl_tcp_ipv4_server_access_denied();
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,14 +223,15 @@ type sockaddr_in = {
|
||||||
mut sin_zero: (u8, u8, u8, u8, u8, u8, u8, u8)
|
mut sin_zero: (u8, u8, u8, u8, u8, u8, u8, u8)
|
||||||
};
|
};
|
||||||
|
|
||||||
// unix size: 28 .. FIXME: stuck with 32 becuse of rust padding structs?
|
// unix size: 28 .. FIXME #1645
|
||||||
|
// stuck with 32 becuse of rust padding structs?
|
||||||
type sockaddr_in6 = {
|
type sockaddr_in6 = {
|
||||||
a0: *u8, a1: *u8,
|
a0: *u8, a1: *u8,
|
||||||
a2: *u8, a3: *u8
|
a2: *u8, a3: *u8
|
||||||
};
|
};
|
||||||
|
|
||||||
// unix size: 28
|
// unix size: 28 .. FIXME #1645
|
||||||
// unix size: 28 .. FIXME: stuck with 32 becuse of rust padding structs?
|
// stuck with 32 becuse of rust padding structs?
|
||||||
type addr_in = {
|
type addr_in = {
|
||||||
a0: *u8, a1: *u8,
|
a0: *u8, a1: *u8,
|
||||||
a2: *u8, a3: *u8
|
a2: *u8, a3: *u8
|
||||||
|
@ -755,11 +756,12 @@ unsafe fn ip4_name(src: &sockaddr_in) -> str {
|
||||||
vec::as_buf(dst) {|dst_buf|
|
vec::as_buf(dst) {|dst_buf|
|
||||||
rustrt::rust_uv_ip4_name(src as *sockaddr_in,
|
rustrt::rust_uv_ip4_name(src as *sockaddr_in,
|
||||||
dst_buf, size);
|
dst_buf, size);
|
||||||
// FIXME: seems that checking the result of uv_ip4_name
|
// seems that checking the result of uv_ip4_name
|
||||||
// doesn't work too well..
|
// doesn't work too well..
|
||||||
// libuv will actually map a malformed input ip to INADDR_NONE,
|
// you're stuck looking at the value of dst_buf
|
||||||
// which is going to be 255.255.255.255 on most
|
// to see if it is the string representation of
|
||||||
// platforms.
|
// INADDR_NONE (0xffffffff or 255.255.255.255 on
|
||||||
|
// many platforms)
|
||||||
str::unsafe::from_buf(dst_buf)
|
str::unsafe::from_buf(dst_buf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1506,7 +1508,7 @@ mod test {
|
||||||
let output = #fmt("sockaddr_in -- native: %u rust: %u",
|
let output = #fmt("sockaddr_in -- native: %u rust: %u",
|
||||||
native_handle_size as uint, rust_handle_size);
|
native_handle_size as uint, rust_handle_size);
|
||||||
log(debug, output);
|
log(debug, output);
|
||||||
// FIXME .. rust appears to pad structs to the nearest byte..?
|
// FIXME #1645 .. rust appears to pad structs to the nearest byte..?
|
||||||
// .. can't get the uv::ll::sockaddr_in6 to == 28 :/
|
// .. can't get the uv::ll::sockaddr_in6 to == 28 :/
|
||||||
// .. so the type always appears to be 32 in size.. which is
|
// .. so the type always appears to be 32 in size.. which is
|
||||||
// good, i guess.. better too big than too little
|
// good, i guess.. better too big than too little
|
||||||
|
@ -1521,7 +1523,7 @@ mod test {
|
||||||
let output = #fmt("addr_in -- native: %u rust: %u",
|
let output = #fmt("addr_in -- native: %u rust: %u",
|
||||||
native_handle_size as uint, rust_handle_size);
|
native_handle_size as uint, rust_handle_size);
|
||||||
log(debug, output);
|
log(debug, output);
|
||||||
// FIXME .. see note above about struct padding
|
// FIXME #1645 .. see note above about struct padding
|
||||||
assert (4u+native_handle_size as uint) == rust_handle_size;
|
assert (4u+native_handle_size as uint) == rust_handle_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue