-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(swarm)!: introduce ListenError
#3375
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
Conversation
ListenErrorListenError
mxinden
left a comment
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.
Change looks good to me.
|
|
||
| /// Possible errors when upgrading an inbound connection. | ||
| #[derive(Debug)] | ||
| pub enum ListenError { |
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.
Mentioning it here, though not directly related: I always confuse LIstenError, signaling a failure on upgrading an inbound connection, with the failure of listening on a new address. Anyone else?
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.
A lot of naming could be improved here :)
I believe this is consistent with the naming of DialError but I agree that something like InboundConnectionError and OutboundConnectionError would probably be better.
I'll see to tidy up these when we remove the connection limits and banned variants.
|
This pull request has merge conflicts. Could you please resolve them @thomaseizinger? 🙏 |
|
This pull request has merge conflicts. Could you please resolve them @thomaseizinger? 🙏 |
Description
In case an error happens for an outgoing connection,
Poolreports anOutgoingConnectionError. This one is mapped to aDialErrorand reported viaSwarmEvent::OutgoingConnectionErrorandFromSwarm::DialFailure.For incoming connections, we didn't quite do the same thing. For one,
SwarmEvent::IncomingConnectionErrordirectly contained aPendingInboundConnectionError. Two,FromSwarm::ListenFailuredid not include an error at all.With this patch, we now introduce a
ListenErrorenum which we use inSwarmEvent::IncomingConnectionErrorand we pass a reference to it along inFromSwarm::ListenFailure.Notes
In #3254, I am going to introduce a
Deniedvariant in bothDialErrorandListenErrorwhich contains the error that aNetworkBehaviourdenied a connection with.Links to any relevant issues
Open Questions
Change checklist
I have added tests that prove my fix is effective or that my feature works