diff --git a/src/server/mod.rs b/src/server/mod.rs index 5b1e0834..4e2cd34e 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -204,10 +204,10 @@ impl + 'static> Http { self.bind(addr, self::compat_impl::new_service(new_service)) } - /// This method allows the ability to share a `Core` with multiple servers. - /// /// Bind the provided `addr` and return a server with a shared `Core`. /// + /// This method allows the ability to share a `Core` with multiple servers. + /// /// This is method will bind the `addr` provided with a new TCP listener ready /// to accept connections. Each connection will be processed with the /// `new_service` object provided as well, creating a new service per @@ -221,11 +221,13 @@ impl + 'static> Http { addr: listener.local_addr()?, listener: listener, }; - Ok(self.serve(incoming, new_service)) + Ok(self.serve_incoming(incoming, new_service)) } - //TODO: make public - fn serve(&self, incoming: I, new_service: S) -> Serve + /// Bind the provided stream of incoming IO objects with a `NewService`. + /// + /// This method allows the ability to share a `Core` with multiple servers. + pub fn serve_incoming(&self, incoming: I, new_service: S) -> Serve where I: Stream, I::Item: AsyncRead + AsyncWrite, S: NewService, Error = ::Error>,