1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-29 20:44:59 +02:00

Remove unused types in actix-tls. Add ActixStream impl for Box<dyn Ac… (#297)

This commit is contained in:
fakeshadow
2021-03-26 06:03:03 -07:00
committed by GitHub
parent a3c9ebc7fa
commit 12d3942b98
5 changed files with 27 additions and 140 deletions

View File

@ -113,7 +113,7 @@ impl Clone for Acceptor {
}
}
impl<T: ActixStream> ServiceFactory<T> for Acceptor {
impl<T: ActixStream + 'static> ServiceFactory<T> for Acceptor {
type Response = TlsStream<T>;
type Error = Error;
type Config = ();
@ -138,16 +138,7 @@ pub struct NativeTlsAcceptorService {
conns: Counter,
}
impl Clone for NativeTlsAcceptorService {
fn clone(&self) -> Self {
Self {
acceptor: self.acceptor.clone(),
conns: self.conns.clone(),
}
}
}
impl<T: ActixStream> Service<T> for NativeTlsAcceptorService {
impl<T: ActixStream + 'static> Service<T> for NativeTlsAcceptorService {
type Response = TlsStream<T>;
type Error = Error;
type Future = LocalBoxFuture<'static, Result<TlsStream<T>, Error>>;
@ -162,9 +153,9 @@ impl<T: ActixStream> Service<T> for NativeTlsAcceptorService {
fn call(&self, io: T) -> Self::Future {
let guard = self.conns.get();
let this = self.clone();
let acceptor = self.acceptor.clone();
Box::pin(async move {
let io = this.acceptor.accept(io).await;
let io = acceptor.accept(io).await;
drop(guard);
io.map(Into::into)
})