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

More precise errors in the nodes module #765

Merged
merged 5 commits into from
Dec 11, 2018
Merged

Conversation

tomaka
Copy link
Member

@tomaka tomaka commented Dec 10, 2018

  • Adds a type Error; associated type to NodeHandler. For now it is always set to io::Error for the NodeHandlerWrapper, otherwise this PR would be even bigger. A further PR should make it generic as well.
  • In handled_node_task and collection.rs, we now properly separate between a reach error (happens when dialing a node or negotiating secio/mplex/yamux) and a node error (happens after we are connected).
  • In handled_node and raw_swarm::NodeError, we distinguish between an error generated by the muxer and an error generated by the node handler. Eventually the StreamMuxer should also get an Error associated type.
  • In RawSwarmEvent::DialError, we now return a RawSwarmReachError which distinguishes between an error produced by the transport layer (including negotiating secio/mplex/yamux) and a mismatch in the peer ID.

@ghost ghost assigned tomaka Dec 10, 2018
@ghost ghost added the in progress label Dec 10, 2018
@@ -406,6 +409,10 @@ impl<TInEvent, TOutEvent, THandler> CollectionStream<TInEvent, TOutEvent, THandl
error: err,
})
},
(Some(TaskState::Connected(_)), _, _) => {
// TODO: this variant shouldn't happen; prove this
panic!()
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the proof could be added as part of this PR?

@tomaka tomaka merged commit 69684a9 into libp2p:master Dec 11, 2018
@ghost ghost removed the in progress label Dec 11, 2018
@tomaka tomaka deleted the nodes-error branch December 11, 2018 14:37
dvdplm added a commit to dvdplm/rust-libp2p that referenced this pull request Dec 19, 2018
* upstream/master:
  More precise error passed to inject_dial_upgrade_error (libp2p#771)
  Update muxers to edition 2018 (libp2p#788)
  it -> this (libp2p#784)
  Add helpers for easier Transports creation (libp2p#777)
  Store information about the local node in the topology (libp2p#772)
  Upgrade secio to the 2018 edition (libp2p#774)
  Switch ping to edition 2018 (libp2p#780)
  Remove PeriodicIdentifyListen and IdentifyListen (libp2p#769)
  Add an IdentifyTopology (libp2p#770)
  More precise errors in the nodes module (libp2p#765)
  Simplify handling of upgrade information. (libp2p#761)
  Add version numbers in the deps in Cargo.toml (libp2p#768)
  Move the transport timeout to libp2p_core (libp2p#764)
  multistream-select: Update to 2018 edition. (libp2p#766)
  Add a mDNS network behaviour (libp2p#736)
  Remove weird line from readme (libp2p#763)
  Rename libp2p-tcp-transport to libp2p-tcp (libp2p#762)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants