diff --git a/src/protocol.rs b/src/protocol.rs index 430ed93..86fd343 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -14,7 +14,7 @@ use tokio_proto::streaming::multiplex::RequestId; use tokio_proto::multiplex::{ClientProto, ServerProto}; use util::Debugger; -// `T` is the type that `Codec` parses. +// `Encode` is the type that `Codec` encodes. `Decode` is the type it decodes. pub struct Codec { state: CodecState, _phantom_data: PhantomData<(Encode, Decode)>, diff --git a/src/server.rs b/src/server.rs index 9537813..54bd951 100644 --- a/src/server.rs +++ b/src/server.rs @@ -61,13 +61,15 @@ pub fn listen_with(addr: SocketAddr, fn listener(addr: &SocketAddr, handle: &Handle) -> io::Result { + const PENDING_CONNECTION_BACKLOG: i32 = 1024; + match *addr { SocketAddr::V4(_) => net2::TcpBuilder::new_v4(), SocketAddr::V6(_) => net2::TcpBuilder::new_v6() }? .reuse_address(true)? .bind(addr)? - .listen(1024) + .listen(PENDING_CONNECTION_BACKLOG) .and_then(|l| { TcpListener::from_listener(l, addr, handle) })