Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore ENOTCONN error during closing state of Connection #653

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/proto/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,12 @@ where
State::Closing(reason, initiator) => {
tracing::trace!("connection closing after flush");
// Flush/shutdown the codec
ready!(self.codec.shutdown(cx))?;
if let Err(err) = ready!(self.codec.shutdown(cx)) {
// ignore ENOTCONN error on shutdown, already in desired state
if reason != Reason::NO_ERROR || err.kind() != io::ErrorKind::NotConnected {
return Poll::Ready(Err(err.into()));
}
}

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