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

fix(swarm): gracefully disable oneshot handler on dial upgrade errors #3577

Merged
merged 3 commits into from
Mar 13, 2023
Merged
Changes from 1 commit
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
Next Next commit
Log error. Set keep_alive to false.
  • Loading branch information
Victor Ermolaev committed Mar 13, 2023
commit 48bb92dfe4d8880f4c6469343063c366c8fd219a
3 changes: 2 additions & 1 deletion swarm/src/handler/one_shot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ where
}
ConnectionEvent::DialUpgradeError(DialUpgradeError { error, .. }) => {
if self.pending_error.is_none() {
self.pending_error = Some(error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, this was the only occurrence of setting self.pending_error. In other words, I don't think pending_error is used anywhere after this change. Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost; there is one more place

if let Some(err) = self.pending_error.take() {
    return Poll::Ready(ConnectionHandlerEvent::Close(err));
}

The resolution of this usage is related to #3591.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if it is never set, then this is dead code so we can delete it straight-away!

Sorry for missing that @mxinden.

log::debug!("DialUpgradeError: {error}");
thomaseizinger marked this conversation as resolved.
Show resolved Hide resolved
self.keep_alive = KeepAlive::No;
}
}
ConnectionEvent::AddressChange(_) | ConnectionEvent::ListenUpgradeError(_) => {}
Expand Down