fix(server): allow TLS shutdown before dropping connections with no_proto
This is important for TLS connections in particular Closes #1380
This commit is contained in:
committed by
Sean McArthur
parent
8e7af7b9f1
commit
60d0eaf891
@@ -447,6 +447,20 @@ where I: AsyncRead + AsyncWrite,
|
||||
|
||||
}
|
||||
|
||||
pub fn shutdown(&mut self) -> Poll<(), io::Error> {
|
||||
match self.io.io_mut().shutdown() {
|
||||
Ok(Async::NotReady) => Ok(Async::NotReady),
|
||||
Ok(Async::Ready(())) => {
|
||||
trace!("shut down IO");
|
||||
Ok(Async::Ready(()))
|
||||
}
|
||||
Err(e) => {
|
||||
debug!("error shutting down IO: {}", e);
|
||||
Err(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn close_read(&mut self) {
|
||||
self.state.close_read();
|
||||
}
|
||||
@@ -540,10 +554,7 @@ where I: AsyncRead + AsyncWrite,
|
||||
#[inline]
|
||||
fn close(&mut self) -> Poll<(), Self::SinkError> {
|
||||
try_ready!(self.poll_complete());
|
||||
self.io.io_mut().shutdown().map_err(|err| {
|
||||
debug!("error closing: {}", err);
|
||||
err
|
||||
})
|
||||
self.shutdown()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -210,6 +210,7 @@ where
|
||||
self.poll_flush()?;
|
||||
|
||||
if self.is_done() {
|
||||
try_ready!(self.conn.shutdown());
|
||||
trace!("Dispatch::poll done");
|
||||
Ok(Async::Ready(()))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user