1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-28 20:10:35 +02:00

add Config argument to NewService

This commit is contained in:
Nikolay Kim
2019-02-22 12:44:37 -08:00
parent 6ea128fac5
commit 862be49e30
32 changed files with 386 additions and 433 deletions

View File

@ -27,7 +27,8 @@ default = []
ssl = ["openssl", "tokio-openssl"]
[dependencies]
actix-service = "0.2.0"
#actix-service = "0.2.0"
actix-service = { path="../actix-service" }
actix-codec = "0.1.0"
futures = "0.1"
tokio-tcp = "0.1"

View File

@ -177,12 +177,13 @@ impl Connector {
cfg: ResolverConfig,
opts: ResolverOpts,
) -> impl NewService<
(),
Request = Connect,
Response = (Connect, TcpStream),
Error = ConnectorError,
InitError = E,
> + Clone {
move || -> FutureResult<Connector, E> { ok(Connector::new(cfg.clone(), opts)) }
move |_: &()| -> FutureResult<Connector, E> { ok(Connector::new(cfg.clone(), opts)) }
}
}

View File

@ -44,7 +44,9 @@ impl<R, T, E> Clone for OpensslConnector<R, T, E> {
}
}
impl<R: RequestHost, T: AsyncRead + AsyncWrite, E> NewService for OpensslConnector<R, T, E> {
impl<R: RequestHost, T: AsyncRead + AsyncWrite, E> NewService<()>
for OpensslConnector<R, T, E>
{
type Request = (R, T);
type Response = (R, SslStream<T>);
type Error = HandshakeError<T>;
@ -52,7 +54,7 @@ impl<R: RequestHost, T: AsyncRead + AsyncWrite, E> NewService for OpensslConnect
type InitError = E;
type Future = FutureResult<Self::Service, Self::InitError>;
fn new_service(&self) -> Self::Future {
fn new_service(&self, _: &()) -> Self::Future {
ok(OpensslConnectorService {
connector: self.connector.clone(),
_t: PhantomData,