Skip to content

Instantly share code, notes, and snippets.

@simmons
simmons / mio-pipe.rs
Created December 22, 2017 19:39
Demonstrate a possible bug where mio uses a pipe write to notify of a mio::Registration event which occurs while epoll_wait() is not happening.
// Demonstrate a possible bug where mio uses a pipe write to notify of
// a mio::Registration event which occurs while epoll_wait() is not
// happening.
//
// RESULTS:
// $ strace -f -s 1024 target/debug/mio-pipe
// ...
// pipe2([5, 6], O_NONBLOCK|O_CLOEXEC) = 0
// epoll_ctl(4, EPOLL_CTL_ADD, 5, {EPOLLIN|EPOLLET, {u32=4294967295, u64=18446744073709551615}}) = 0
// epoll_ctl(4, EPOLL_CTL_ADD, 3, {EPOLLIN, {u32=0, u64=0}}) = 0
extern crate multipart;
extern crate reqwest;
use multipart::client::lazy::Multipart;
use reqwest::mime;
use std::process;
use std::io::Read;
const URL: &'static str = "http://example.com/fileupload";
const UPLOAD_FORM_FIELD_NAME: &'static str = "thefile";

Keybase proof

I hereby claim:

  • I am simmons on github.
  • I am simmons (https://keybase.io/simmons) on keybase.
  • I have a public key whose fingerprint is A8DC AF4E B0DA 43DB F6D4 824C 84D0 38AD DA28 0D3F

To claim this, I am signing this object: