Closed ebarnard closed 8 years ago
This allows a protocol to get details of the underlying stream it is connected to.
e.g.
trait IpStream { fn peer_addr(&self) -> io::Result<SocketAddr>; fn local_addr(&self) -> io::Result<SocketAddr>; } impl IpStream for ::mio::tcp::TcpStream { fn peer_addr(&self) -> io::Result<SocketAddr> { ::mio::tcp::TcpStream::peer_addr(self) } fn local_addr(&self) -> io::Result<SocketAddr> { ::mio::tcp::TcpStream::local_addr(self) } } impl<T: IpStream, C, H: Handler<C>+Send> Protocol<T, C> for Client<C, H> { fn accepted(conn: &T, _ctx: &mut C) -> Self { let local_addr = conn.local_addr(); ...
Looks fine. Thanks!
This allows a protocol to get details of the underlying stream it is connected to.
e.g.