-
Notifications
You must be signed in to change notification settings - Fork 1k
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(swarm): add ConnectionDenied::downcast_ref
#4020
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Add a changelog entry please.
misc/connection-limits/src/lib.rs
Outdated
@@ -466,6 +466,57 @@ mod tests { | |||
quickcheck(prop as fn(_)); | |||
} | |||
|
|||
#[test] | |||
fn max_established_incoming_downcast_ref() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this test. We don't actually control any logic here other than forwarding calls so the typesystem should be good enough :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I remove the test or just leave it be?
ConnectionDenied::downcast_ref
This pull request has merge conflicts. Could you please resolve them @nathanielc? 🙏 |
Prior to this change it was possible to only have a reference to a ConnectionDenied error and not be able to downcast it to check if the connection-limits produced the error.
@thomaseizinger Thanks for the review, I have fixed the conflicts, added a changelog entry and removed the unnecessary test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Description
Prior to this change it was only possible to downcast a
ConnectionDenied
error when you had ownership of it which isn't the case insideNetworkBehaviour
s. This change allows downcasting by reference.See #4018.
Change checklist