|
|
@ -39,10 +39,12 @@ mod encryption { |
|
|
|
use tungstenite::Error; |
|
|
|
use tungstenite::Error; |
|
|
|
use tungstenite::stream::Mode; |
|
|
|
use tungstenite::stream::Mode; |
|
|
|
|
|
|
|
|
|
|
|
use stream::NoDelay; |
|
|
|
use stream::{NoDelay, Stream as StreamSwitcher}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// A stream that might be protected with TLS.
|
|
|
|
|
|
|
|
pub type MaybeTlsStream<S> = StreamSwitcher<S, TlsStream<S>>; |
|
|
|
|
|
|
|
|
|
|
|
pub use stream::Stream as StreamSwitcher; |
|
|
|
pub type AutoStream<S> = MaybeTlsStream<S>; |
|
|
|
pub type AutoStream<S> = StreamSwitcher<S, TlsStream<S>>; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl<T: Read + Write + NoDelay> NoDelay for TlsStream<T> { |
|
|
|
impl<T: Read + Write + NoDelay> NoDelay for TlsStream<T> { |
|
|
|
fn set_nodelay(&mut self, nodelay: bool) -> IoResult<()> { |
|
|
|
fn set_nodelay(&mut self, nodelay: bool) -> IoResult<()> { |
|
|
@ -68,6 +70,9 @@ mod encryption { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature="tls")] |
|
|
|
|
|
|
|
pub use self::encryption::MaybeTlsStream; |
|
|
|
|
|
|
|
|
|
|
|
#[cfg(not(feature="tls"))] |
|
|
|
#[cfg(not(feature="tls"))] |
|
|
|
mod encryption { |
|
|
|
mod encryption { |
|
|
|
use futures::{future, Future}; |
|
|
|
use futures::{future, Future}; |
|
|
|