carllerche/mio — pull request #17 by cgaebel (2014-09-22 07:22:57+00:00)
Title: Added a simple Tcp Server wrapper.

Having to implement readable and writable is a huge pain. I tried to wrap up
the ugly bits in `server.rs`, and ported the existing tests to use the new
framework.

I'll spend a bit of time this week adding a bunch of documentation to the things
I've touched, but this should be ready for some review work now.
`test_echo_server.rs` is probably the best demonstration of what the new API
looks like.

I was going to make the test spawn a whole bunch of clients to see how high I
could get the concurrency, but unfortuantely POSIX `connect` likes to return
`EISCONN` if a socket is non-blocking and I'm already connected to it. I think
we might need to do `connect` in a thread pool to get lots of connections from
and to the same places.