提交 b6b13863 编写于 作者: J Jeff Olson 提交者: Brian Anderson

std: getting uv_ip6_* utils working in uv::ll

.. stub out some brokeness in net::tcp as a result of ipv6 coming online
上级 30f26ddb
......@@ -1213,9 +1213,7 @@ fn ipv4_ip_addr_to_sockaddr_in(input_ip: ip::ip_addr,
ip::ipv4(addr) {
uv::ll::ip4_addr(addr_str, port as int)
}
ip::ipv6(_,_,_,_,_,_,_,_) {
fail "FIXME (#2656) ipv6 not yet supported";
}
_ { fail "only works w/ ipv4";}
}
}
......
......@@ -710,7 +710,27 @@ unsafe fn ip4_name(src: &sockaddr_in) -> str {
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8];
let size = 16 as libc::size_t;
vec::as_buf(dst) {|dst_buf|
let result = rustrt::rust_uv_ip4_name(src as *sockaddr_in,
rustrt::rust_uv_ip4_name(src as *sockaddr_in,
dst_buf, size);
// FIXME: seems that checking the result of uv_ip4_name
// doesn't work too well..
// libuv will actually map a malformed input ip to INADDR_NONE,
// which is going to be 255.255.255.255 on most
// platforms.
str::unsafe::from_buf(dst_buf);
}
}
unsafe fn ip6_name(src: &sockaddr_in6) -> str {
// ipv6 addr max size: 45 + 1 trailing null byte
let dst: [u8] = [0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
0u8,0u8,0u8,0u8,0u8,0u8];
let size = 46 as libc::size_t;
vec::as_buf(dst) {|dst_buf|
let result = rustrt::rust_uv_ip6_name(src as *sockaddr_in6,
dst_buf, size);
alt result {
0i32 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册