-
Notifications
You must be signed in to change notification settings - Fork 957
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
swarm/handler: Split inject_listen_upgrade_error
into two
#2894
Comments
I am in favor of this. The error nesting is quite annoying to deal with! |
I can take a look into it this week. |
In case neither us nor any user ever makes use of this method, we should consider not introducing it in the first place. |
no worries Max, I'll take it! |
Thanks @jxs ! |
update: waiting on #3264 to be merged to start tackling this. |
@mxinden there's an issue with the separation of errors, rust-libp2p/swarm/src/connection.rs Lines 183 to 186 in 9c96bbb
to address this, we can have #[derive(Copy, Clone, Debug)]
pub enum ConnectionHandlerNegotiationError {
/// The opening attempt timed out before the negotiation was fully completed.
Timeout,
/// There was an error in the timer used.
Timer,
} Given that this issue was created when the api was still with the many Basically switching a third level of enum variant, Meanwhile the |
Just to make sure we are on the same page, the
Sounds good to me. Might be a relic from when we used a different timer library. |
Ok, thanks for the clarification Max. But then who should deal with the Timeouts when negotiating streams, or rather, where were you thinking having |
On the outbound side we know which On the inbound side, we don't know which Does the reasoning above make sense? |
yes, thanks Max! Submitted #3307 |
This is stale and has been resolved by trimming down |
Description
Split the
ConectionHandler::inject_listen_upgrade_error
into two methods:inject_listen_negotiation_error
for errors during the multistream select protocol execution. Not specifically related to the protocol of thisConnectionHandler
.inject_listen_upgrade_error
for errors during the actualyInboundUpgrade
. Specific to the protocol of thisConnectionHandler
.Motivation
Using the same method for both use-cases is error prone. E.g. see
libp2p-relay
where we print an error for a potentially unrelated issue:rust-libp2p/protocols/relay/src/v2/client/handler.rs
Lines 379 to 383 in 66c2755
Current Implementation
Today
ConnectionHandler::inject_listen_upgrade_error
is called for both multistream select negotiation errors and protocol specific upgrade errors.Are you planning to do it yourself in a pull request?
No
//CC @dignifiedquire as we ran into this during our recent debugging session.
Still remember discussing this a long time ago with @romanb.
The text was updated successfully, but these errors were encountered: