From 185f01093783b1356d3d135eaa1475b3584b723e Mon Sep 17 00:00:00 2001 From: PZ Read Date: Fri, 26 May 2017 16:38:02 +0800 Subject: [PATCH] Add async builders for custom session. --- src/lib.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 8728219..87f461f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,6 +52,15 @@ impl ClientConfigExt for Arc { } } +pub fn connect_async_with_session(stream: S, session: ClientSession) + -> ConnectAsync + where S: AsyncRead + AsyncWrite +{ + ConnectAsync(MidHandshake { + inner: Some(TlsStream::new(stream, session)) + }) +} + impl ServerConfigExt for Arc { fn accept_async(&self, stream: S) -> AcceptAsync @@ -63,6 +72,15 @@ impl ServerConfigExt for Arc { } } +pub fn accept_async_with_session(stream: S, session: ServerSession) + -> AcceptAsync + where S: AsyncRead + AsyncWrite +{ + AcceptAsync(MidHandshake { + inner: Some(TlsStream::new(stream, session)) + }) +} + impl Future for ConnectAsync { type Item = TlsStream; type Error = io::Error;