Skip to content

Instantly share code, notes, and snippets.

@pusateri
pusateri / mysend.rs
Last active March 23, 2019 15:46
Figuring out how to async send message
lazy_static! {
static ref USMAP: Arc<Mutex<HashMap<String, UpdateServer>>> = Arc::new(Mutex::new(HashMap::new()));
}
#[derive(Debug)]
pub struct UpdateServer {
subdomain: String,
sa: SocketAddr,
sink: SplitSink<UdpFramed<BytesCodec>>,
@pusateri
pusateri / mio-timer-test.rs
Created April 22, 2019 23:39
mio extra timers don't fire
use std::time::Duration;
use mio::{Events, Ready, Poll, PollOpt, Token};
use mio_extras::channel;
use mio_extras::timer::Timer;
fn main() {
const CHANNEL: Token = Token(0);
let poll = Poll::new().unwrap();
let (tx, rx) = channel::channel::<u32>();
let mut events = Events::with_capacity(1024);