feat(server): change NewService to MakeService with connection context
				
					
				
			This adjusts the way `Service`s are created for a `hyper::Server`. The `MakeService` trait allows receiving an argument when creating a `Service`. The implementation for `hyper::Server` expects to pass a reference to the accepted transport (so, `&Incoming::Item`). The user can inspect the transport before making a `Service`. In practice, this allows for things like getting the remote socket address, or the TLS certification, or similar. To prevent a breaking change, there is a blanket implementation of `MakeService` for any `NewService`. Besides implementing `MakeService` directly, there is also added `hyper::service::make_service_fn`. Closes #1650
This commit is contained in:
		| @@ -8,7 +8,7 @@ use tokio_reactor::Handle; | ||||
| use tokio_tcp::TcpListener; | ||||
| use tokio_timer::Delay; | ||||
|  | ||||
| use self::addr_stream::AddrStream; | ||||
| pub use self::addr_stream::AddrStream; | ||||
|  | ||||
| /// A stream of connections from binding to an address. | ||||
| #[must_use = "streams do nothing unless polled"] | ||||
| @@ -194,6 +194,7 @@ mod addr_stream { | ||||
|     use tokio_io::{AsyncRead, AsyncWrite}; | ||||
|  | ||||
|  | ||||
|     /// A transport returned yieled by `AddrIncoming`. | ||||
|     #[derive(Debug)] | ||||
|     pub struct AddrStream { | ||||
|         inner: TcpStream, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user