#![feature(globs)]
#![feature(phase)]
extern crate mio;
#[phase(plugin, link)]
extern crate log;
pub use ports::localhost;
mod test_close_on_drop;
mod test_echo_server;
mod test_notify;
mod test_timer;
mod test_udp_socket;
mod test_udp_socket_connectionless;
mod ports {
use std::sync::atomic::{AtomicUint, SeqCst, INIT_ATOMIC_UINT};
static mut NEXT_PORT: AtomicUint = INIT_ATOMIC_UINT;
const FIRST_PORT: uint = 18080;
fn next_port() -> uint {
unsafe {
NEXT_PORT.compare_and_swap(0, FIRST_PORT, SeqCst);
NEXT_PORT.fetch_add(1, SeqCst)
}
}
pub fn localhost() -> String {
format!("127.0.0.1:{}", next_port())
}
}