aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/ssl/mod.rs
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2015-12-18 22:41:57 -0800
committerSteven Fackler <[email protected]>2015-12-18 22:41:57 -0800
commit3fdfe56f25a2edeed63e18d24d501797ffb0fb2f (patch)
tree52c55ef95da2f49147f2db4a1d3ed4b86a7e9ec5 /openssl/src/ssl/mod.rs
parentMerge branch 'release-v0.7.3' into release (diff)
parentRelease v0.7.4 (diff)
downloadrust-openssl-0.7.4.tar.xz
rust-openssl-0.7.4.zip
Merge branch 'release-v0.7.4' into releasev0.7.4
Diffstat (limited to 'openssl/src/ssl/mod.rs')
-rw-r--r--openssl/src/ssl/mod.rs34
1 files changed, 20 insertions, 14 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index d529347f..955f10fd 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -10,7 +10,7 @@ use std::str;
use std::net;
use std::path::Path;
use std::ptr;
-use std::sync::{Once, ONCE_INIT, Mutex};
+use std::sync::{Once, ONCE_INIT, Mutex, Arc};
use std::cmp;
use std::any::Any;
#[cfg(any(feature = "npn", feature = "alpn"))]
@@ -778,6 +778,7 @@ impl Drop for Ssl {
}
impl Clone for Ssl {
+ /// # Deprecated
fn clone(&self) -> Ssl {
unsafe { rust_SSL_clone(self.ssl) };
Ssl { ssl: self.ssl }
@@ -1003,23 +1004,22 @@ make_LibSslError! {
/// A stream wrapper which handles SSL encryption for an underlying stream.
pub struct SslStream<S> {
ssl: Ssl,
- _method: Box<ffi::BIO_METHOD>, // :(
+ _method: Arc<ffi::BIO_METHOD>, // NOTE: this *must* be after the Ssl field so things drop right
_p: PhantomData<S>,
}
unsafe impl<S: Send> Send for SslStream<S> {}
+/// # Deprecated
+///
+/// This method does not behave as expected and will be removed in a future
+/// release.
impl<S: Clone + Read + Write> Clone for SslStream<S> {
fn clone(&self) -> SslStream<S> {
- let stream = self.get_ref().clone();
- Self::new_base(self.ssl.clone(), stream)
- }
-}
-
-impl<S> Drop for SslStream<S> {
- fn drop(&mut self) {
- unsafe {
- let _ = bio::take_stream::<S>(self.ssl.get_raw_rbio());
+ SslStream {
+ ssl: self.ssl.clone(),
+ _method: self._method.clone(),
+ _p: PhantomData,
}
}
}
@@ -1232,10 +1232,16 @@ impl<S> SslStream<S> {
}
impl SslStream<::std::net::TcpStream> {
- /// Like `TcpStream::try_clone`.
+ /// # Deprecated
+ ///
+ /// This method does not behave as expected and will be removed in a future
+ /// release.
pub fn try_clone(&self) -> io::Result<SslStream<::std::net::TcpStream>> {
- let stream = try!(self.get_ref().try_clone());
- Ok(Self::new_base(self.ssl.clone(), stream))
+ Ok(SslStream {
+ ssl: self.ssl.clone(),
+ _method: self._method.clone(),
+ _p: PhantomData,
+ })
}
}