Added try_clone to SslStream for SslStream<TcpStream>.
This commit is contained in:
parent
5154581c32
commit
c3eee3b194
|
|
@ -1,4 +1,4 @@
|
|||
#![feature(unsafe_destructor, core, io, std_misc, path, os, unique)]
|
||||
#![feature(unsafe_destructor, core, io, std_misc, net, path, os, unique)]
|
||||
#![cfg_attr(test, feature(net, fs))]
|
||||
#![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/openssl")]
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use std::io;
|
|||
use std::io::prelude::*;
|
||||
use std::ffi::AsOsStr;
|
||||
use std::mem;
|
||||
use std::net;
|
||||
use std::num::FromPrimitive;
|
||||
use std::num::Int;
|
||||
use std::path::Path;
|
||||
|
|
@ -437,6 +438,17 @@ pub struct SslStream<S> {
|
|||
buf: Vec<u8>
|
||||
}
|
||||
|
||||
impl SslStream<net::TcpStream> {
|
||||
/// Create a new independently owned handle to the underlying socket.
|
||||
pub fn try_clone(&self) -> io::Result<SslStream<net::TcpStream>> {
|
||||
Ok(SslStream {
|
||||
stream: try!(self.stream.try_clone()),
|
||||
ssl: self.ssl.clone(),
|
||||
buf: self.buf.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> fmt::Debug for SslStream<S> where S: fmt::Debug {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(fmt, "SslStream {{ stream: {:?}, ssl: {:?} }}", self.stream, self.ssl)
|
||||
|
|
|
|||
Loading…
Reference in New Issue