stream: add socket accessors

The other TLS libraries all provide those methods on their
stream implementations, this helps make things more similar

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
This commit is contained in:
Marc-Antoine Perennou 2019-05-27 09:53:04 +02:00 committed by ctz
parent 05b8915b3f
commit 94563739d3
1 changed files with 10 additions and 0 deletions

View File

@ -101,6 +101,16 @@ impl<S, T> StreamOwned<S, T> where S: Session, T: Read + Write {
pub fn new(sess: S, sock: T) -> StreamOwned<S, T> {
StreamOwned { sess, sock }
}
/// Get a reference to the underlying socket
pub fn get_ref(&self) -> &T {
&self.sock
}
/// Get a mutable reference to the underlying socket
pub fn get_mut(&mut self) -> &T {
&mut self.sock
}
}
impl<'a, S, T> StreamOwned<S, T> where S: Session, T: Read + Write {