diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 2775c4c8..cca369a2 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -1416,6 +1416,16 @@ impl MaybeSslStream where S: Read+Write { } } +impl MaybeSslStream { + /// Like `TcpStream::try_clone`. + pub fn try_clone(&self) -> io::Result> { + match *self { + MaybeSslStream::Ssl(ref s) => s.try_clone().map(MaybeSslStream::Ssl), + MaybeSslStream::Normal(ref s) => s.try_clone().map(MaybeSslStream::Normal), + } + } +} + /// An SSL stream wrapping a nonblocking socket. #[derive(Clone)] pub struct NonblockingSslStream {