use std::cast;
use std::io::IoError;
use std::io::net::ip;
-use std::libc::{size_t, ssize_t, c_int, c_void, c_uint};
-use std::libc;
+use libc::{size_t, ssize_t, c_int, c_void, c_uint};
+use libc;
use std::mem;
use std::ptr;
use std::rt::rtio;
/// Generic functions related to dealing with sockaddr things
////////////////////////////////////////////////////////////////////////////////
-pub fn htons(u: u16) -> u16 { mem::to_be16(u as i16) as u16 }
-pub fn ntohs(u: u16) -> u16 { mem::from_be16(u as i16) as u16 }
+pub fn htons(u: u16) -> u16 { mem::to_be16(u) }
+pub fn ntohs(u: u16) -> u16 { mem::from_be16(u) }
pub fn sockaddr_to_addr(storage: &libc::sockaddr_storage,
len: uint) -> ip::SocketAddr {
handle: *uvll::uv_tcp_t,
stream: StreamWatcher,
home: HomeHandle,
- priv refcount: Refcount,
+ refcount: Refcount,
// libuv can't support concurrent reads and concurrent writes of the same
// stream object, so we use these access guards in order to arbitrate among
// multiple concurrent reads and writes. Note that libuv *can* read and
// write simultaneously, it just can't read and read simultaneously.
- priv read_access: Access,
- priv write_access: Access,
+ read_access: Access,
+ write_access: Access,
}
pub struct TcpListener {
home: HomeHandle,
handle: *uvll::uv_pipe_t,
- priv closing_task: Option<BlockedTask>,
- priv outgoing: Sender<Result<~rtio::RtioTcpStream:Send, IoError>>,
- priv incoming: Receiver<Result<~rtio::RtioTcpStream:Send, IoError>>,
+ closing_task: Option<BlockedTask>,
+ outgoing: Sender<Result<~rtio::RtioTcpStream:Send, IoError>>,
+ incoming: Receiver<Result<~rtio::RtioTcpStream:Send, IoError>>,
}
pub struct TcpAcceptor {
home: HomeHandle,
// See above for what these fields are
- priv refcount: Refcount,
- priv read_access: Access,
- priv write_access: Access,
+ refcount: Refcount,
+ read_access: Access,
+ write_access: Access,
}
impl UdpWatcher {
fn connect_close_ip4() {
match TcpWatcher::connect(local_loop(), next_test_ip4()) {
Ok(..) => fail!(),
- Err(e) => assert_eq!(e.name(), ~"ECONNREFUSED"),
+ Err(e) => assert_eq!(e.name(), "ECONNREFUSED".to_owned()),
}
}
fn connect_close_ip6() {
match TcpWatcher::connect(local_loop(), next_test_ip6()) {
Ok(..) => fail!(),
- Err(e) => assert_eq!(e.name(), ~"ECONNREFUSED"),
+ Err(e) => assert_eq!(e.name(), "ECONNREFUSED".to_owned()),
}
}
Ok(10) => {} e => fail!("{:?}", e),
}
for i in range(0, 10u8) {
- assert_eq!(buf[i], i + 1);
+ assert_eq!(buf[i as uint], i + 1);
}
}
Err(e) => fail!("{:?}", e)
Ok(10) => {} e => fail!("{:?}", e),
}
for i in range(0, 10u8) {
- assert_eq!(buf[i], i + 1);
+ assert_eq!(buf[i as uint], i + 1);
}
}
Err(e) => fail!("{:?}", e)
e => fail!("{:?}", e),
}
for i in range(0, 10u8) {
- assert_eq!(buf[i], i + 1);
+ assert_eq!(buf[i as uint], i + 1);
}
}
Err(e) => fail!("{:?}", e)
e => fail!("{:?}", e),
}
for i in range(0, 10u8) {
- assert_eq!(buf[i], i + 1);
+ assert_eq!(buf[i as uint], i + 1);
}
}
Err(e) => fail!("{:?}", e)
}
reads += 1;
- tx2.try_send(());
+ let _ = tx2.send_opt(());
}
// Make sure we had multiple reads