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

feat: don't report inbound stream upgrade errors to handler #3605

Merged
merged 32 commits into from
May 8, 2023

Conversation

thomaseizinger
Copy link
Contributor

@thomaseizinger thomaseizinger commented Mar 13, 2023

Description

When an inbound stream upgrade fails, there isn't a whole lot we can do about that in the handler. In fact, for several errors, we wouldn't even know which specific handler to target, for example, NegotiationFailed. Similiarly, in case of an IO error during the upgrade, we don't know which handler the stream was eventually meant to be for.

Notes & open questions

This is a breaking change, thus draft for now.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

🎉 I am very much looking forward to this pull request landing! This has been a thorn in my eye for long.

swarm/src/connection.rs Outdated Show resolved Hide resolved
protocols/relay/src/behaviour/handler.rs Show resolved Hide resolved
protocols/relay/src/priv_client/handler.rs Show resolved Hide resolved
protocols/request-response/src/handler.rs Show resolved Hide resolved
protocols/request-response/src/handler.rs Show resolved Hide resolved
swarm/src/connection.rs Outdated Show resolved Hide resolved
@mxinden
Copy link
Member

mxinden commented Mar 22, 2023

@thomaseizinger let me know if you want another review here.

@thomaseizinger
Copy link
Contributor Author

@thomaseizinger let me know if you want another review here.

Go for it. It is only a draft because it is a breaking change.

@mergify

This comment was marked as resolved.

@mergify

This comment was marked as resolved.

@mergify

This comment was marked as resolved.

@mergify

This comment was marked as resolved.

@mergify

This comment was marked as resolved.

@mergify

This comment was marked as resolved.

@mergify

This comment was marked as resolved.

@thomaseizinger thomaseizinger marked this pull request as ready for review May 2, 2023 12:31
@mergify

This comment was marked as resolved.

mxinden
mxinden previously approved these changes May 4, 2023
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Ready to merge from my end. Great work!

}));
}
}
self.pending_error = Some(ConnectionHandlerUpgrErr::Upgrade(UpgradeError::Apply(
Copy link
Member

Choose a reason for hiding this comment

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

I think we are on the same page when I say that libp2p-relay should not be closing the connection based on pending_error via ConnectionHandlerEvent::Close further below in poll. That said, let's not fix it here but along with #3591.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it should be a much easier change once this lands too!

protocols/request-response/CHANGELOG.md Outdated Show resolved Hide resolved
@mergify

This comment was marked as resolved.

@mergify

This comment was marked as resolved.

@mxinden mxinden added the send-it label May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants