std: getting uv_ip6_* utils working in uv::ll
.. stub out some brokeness in net::tcp as a result of ipv6 coming online
This commit is contained in:
parent
30f26ddbc9
commit
b6b138630e
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user