-
Notifications
You must be signed in to change notification settings - Fork 964
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)!: introduce ListenError
#3375
Conversation
ListenError
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.
Change looks good to me.
@@ -1677,6 +1683,68 @@ impl error::Error for DialError { | |||
} | |||
} | |||
|
|||
/// 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,
Pool
reports anOutgoingConnectionError
. This one is mapped to aDialError
and reported viaSwarmEvent::OutgoingConnectionError
andFromSwarm::DialFailure
.For incoming connections, we didn't quite do the same thing. For one,
SwarmEvent::IncomingConnectionError
directly contained aPendingInboundConnectionError
. Two,FromSwarm::ListenFailure
did not include an error at all.With this patch, we now introduce a
ListenError
enum which we use inSwarmEvent::IncomingConnectionError
and we pass a reference to it along inFromSwarm::ListenFailure
.Notes
In #3254, I am going to introduce a
Denied
variant in bothDialError
andListenError
which contains the error that aNetworkBehaviour
denied 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