chore(server): stop using deprecated method internally

This commit is contained in:
Sean McArthur
2019-09-11 11:00:48 -07:00
parent 1f3a8393e8
commit d36e028b21
2 changed files with 22 additions and 1 deletions

View File

@@ -470,6 +470,27 @@ impl<E> Http<E> {
protocol: self.clone(),
}
}
pub(super) fn serve<I, IO, IE, S, Bd>(&self, incoming: I, make_service: S) -> Serve<I, S, E>
where
I: Accept<Conn=IO, Error=IE>,
IE: Into<Box<dyn StdError + Send + Sync>>,
IO: AsyncRead + AsyncWrite + Unpin,
S: MakeServiceRef<
IO,
Body,
ResBody=Bd,
>,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
Bd: Payload,
E: H2Exec<<S::Service as Service<Body>>::Future, Bd>,
{
Serve {
incoming,
make_service,
protocol: self.clone(),
}
}
}

View File

@@ -394,7 +394,7 @@ impl<I, E> Builder<I, E> {
E: NewSvcExec<I::Conn, S::Future, S::Service, E, NoopWatcher>,
E: H2Exec<<S::Service as Service<Body>>::Future, B>,
{
let serve = self.protocol.serve_incoming(self.incoming, new_service);
let serve = self.protocol.serve(self.incoming, new_service);
let spawn_all = serve.spawn_all();
Server {
spawn_all,