Skip to content

Commit c11e186

Browse files
committed
server: Ignore NotConnected errors on shutdown
Related to hyperium/tonic#1183
1 parent 07d20b1 commit c11e186

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/proto/connection.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,13 @@ where
282282
State::Closing(reason, initiator) => {
283283
tracing::trace!("connection closing after flush");
284284
// Flush/shutdown the codec
285-
ready!(self.codec.shutdown(cx))?;
285+
if let Err(e) = ready!(self.codec.shutdown(cx)) {
286+
// If the error kind is NotConnected then ignore that
287+
// since it means the connection is already shutdown.
288+
if e.kind() != io::ErrorKind::NotConnected {
289+
return Poll::Ready(Err(e.into()));
290+
}
291+
}
286292

287293
// Transition the state to error
288294
self.inner.state = State::Closed(reason, initiator);

0 commit comments

Comments
 (0)