From 99ad96b2122654bc490f1397b17430c494949ba1 Mon Sep 17 00:00:00 2001 From: Martin Algesten Date: Mon, 22 Oct 2018 19:19:58 +0100 Subject: [PATCH] explicit shutdown on tls connections --- src/stream.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/stream.rs b/src/stream.rs index b316ed5..ae09308 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -18,6 +18,16 @@ pub enum Stream { Test(Box, Vec), } +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 { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::result::Result<(), ::std::fmt::Error> { write!(