Add async builders for custom session.
This commit is contained in:
parent
72c9c1d59e
commit
185f010937
18
src/lib.rs
18
src/lib.rs
@ -52,6 +52,15 @@ impl ClientConfigExt for Arc<ClientConfig> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn connect_async_with_session<S>(stream: S, session: ClientSession)
|
||||||
|
-> ConnectAsync<S>
|
||||||
|
where S: AsyncRead + AsyncWrite
|
||||||
|
{
|
||||||
|
ConnectAsync(MidHandshake {
|
||||||
|
inner: Some(TlsStream::new(stream, session))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
impl ServerConfigExt for Arc<ServerConfig> {
|
impl ServerConfigExt for Arc<ServerConfig> {
|
||||||
fn accept_async<S>(&self, stream: S)
|
fn accept_async<S>(&self, stream: S)
|
||||||
-> AcceptAsync<S>
|
-> AcceptAsync<S>
|
||||||
@ -63,6 +72,15 @@ impl ServerConfigExt for Arc<ServerConfig> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn accept_async_with_session<S>(stream: S, session: ServerSession)
|
||||||
|
-> AcceptAsync<S>
|
||||||
|
where S: AsyncRead + AsyncWrite
|
||||||
|
{
|
||||||
|
AcceptAsync(MidHandshake {
|
||||||
|
inner: Some(TlsStream::new(stream, session))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
impl<S: AsyncRead + AsyncWrite> Future for ConnectAsync<S> {
|
impl<S: AsyncRead + AsyncWrite> Future for ConnectAsync<S> {
|
||||||
type Item = TlsStream<S, ClientSession>;
|
type Item = TlsStream<S, ClientSession>;
|
||||||
type Error = io::Error;
|
type Error = io::Error;
|
||||||
|
Loading…
Reference in New Issue
Block a user