explicit shutdown on tls connections

This commit is contained in:
Martin Algesten
2018-10-22 19:19:58 +01:00
parent 10146716db
commit 99ad96b212

View File

@@ -18,6 +18,16 @@ pub enum Stream {
Test(Box<dyn Read + Send>, Vec<u8>), Test(Box<dyn Read + Send>, Vec<u8>),
} }
impl Drop for Stream {
fn drop(&mut self) {
match self {
#[cfg(feature = "tls")]
Stream::Https(s) => { s.shutdown().ok(); },
_ => (),
}
}
}
impl ::std::fmt::Debug for Stream { impl ::std::fmt::Debug for Stream {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::result::Result<(), ::std::fmt::Error> { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::result::Result<(), ::std::fmt::Error> {
write!( write!(