From 66a5d113d4ed6a8eb38a4e47ceab28a4b122ad12 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Thu, 9 Aug 2018 10:36:30 -0700 Subject: [PATCH] Shutdown the stream along with connection (#304) This will in particular send close notify alerts for TLS streams. --- src/proto/connection.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/proto/connection.rs b/src/proto/connection.rs index e2e9f4b..fb1e83e 100644 --- a/src/proto/connection.rs +++ b/src/proto/connection.rs @@ -189,7 +189,7 @@ where State::Open => { match self.poll2() { // The connection has shutdown normally - Ok(Async::Ready(())) => return self.take_error(Reason::NO_ERROR), + Ok(Async::Ready(())) => self.state = State::Closing(Reason::NO_ERROR), // The connection is not ready to make progress Ok(Async::NotReady) => { // Ensure all window updates have been sent. @@ -253,8 +253,8 @@ where } State::Closing(reason) => { trace!("connection closing after flush, reason={:?}", reason); - // Flush the codec - try_ready!(self.codec.flush()); + // Flush/shutdown the codec + try_ready!(self.codec.shutdown()); // Transition the state to error self.state = State::Closed(reason);