From fd3724e52857e39d8095c3b39aa5970dfd243356 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 29 Feb 2024 10:52:01 +0100 Subject: [PATCH] Ignore NotConnected error in poll_shutdown() --- src/common/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/mod.rs b/src/common/mod.rs index 442e295d..15c76c5b 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -301,7 +301,13 @@ where while self.session.wants_write() { ready!(self.write_io(cx))?; } - Pin::new(&mut self.io).poll_shutdown(cx) + + Poll::Ready(match ready!(Pin::new(&mut self.io).poll_shutdown(cx)) { + Ok(()) => Ok(()), + // When trying to shutdown, not being connected seems fine + Err(err) if err.kind() == io::ErrorKind::NotConnected => Ok(()), + Err(err) => Err(err), + }) } }