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

Multiple connections per peer #1440

Merged
merged 34 commits into from
Mar 4, 2020
Merged

Multiple connections per peer #1440

merged 34 commits into from
Mar 4, 2020

Commits on Feb 13, 2020

  1. Allow multiple connections per peer in libp2p-core.

    Instead of trying to enforce a single connection per peer,
    which involves quite a bit of additional complexity e.g.
    to prioritise simultaneously opened connections and can
    have other undesirable consequences [1], we now
    make multiple connections per peer a feature.
    
    The gist of these changes is as follows:
    
    The concept of a "node" with an implicit 1-1 correspondence
    to a connection has been replaced with the "first-class"
    concept of a "connection". The code from `src/nodes` has moved
    (with varying degrees of modification) to `src/connection`.
    A `HandledNode` has become a `Connection`, a `NodeHandler` a
    `ConnectionHandler`, the `CollectionStream` was the basis for
    the new `connection::Pool`, and so forth.
    
    Conceptually, a `Network` contains a `connection::Pool` which
    in turn internally employs the `connection::Manager` for
    handling the background `connection::manager::Task`s, one
    per connection, as before. These are all considered implementation
    details. On the public API, `Peer`s are managed as before through
    the `Network`, except now the API has changed with the shift of focus
    to (potentially multiple) connections per peer. The `NetworkEvent`s have
    accordingly also undergone changes.
    
    The Swarm APIs remain largely unchanged, except for the fact that
    `inject_replaced` is no longer called. It may now practically happen
    that multiple `ProtocolsHandler`s are associated with a single
    `NetworkBehaviour`, one per connection. If implementations of
    `NetworkBehaviour` rely somehow on communicating with exactly
    one `ProtocolsHandler`, this may cause issues, but it is unlikely.
    
    [1]: paritytech/substrate#4272
    Roman S. Borschel committed Feb 13, 2020
    Configuration menu
    Copy the full SHA
    4fa8360 View commit details
    Browse the repository at this point in the history
  2. Fix intra-rustdoc links.

    Roman S. Borschel committed Feb 13, 2020
    Configuration menu
    Copy the full SHA
    5f182f0 View commit details
    Browse the repository at this point in the history

Commits on Feb 14, 2020

  1. Update core/src/connection/pool.rs

    Co-Authored-By: Max Inden <mail@max-inden.de>
    romanb and mxinden authored Feb 14, 2020
    Configuration menu
    Copy the full SHA
    66566e4 View commit details
    Browse the repository at this point in the history

Commits on Feb 16, 2020

  1. Address some review feedback and fix doc links.

    Roman S. Borschel committed Feb 16, 2020
    Configuration menu
    Copy the full SHA
    51b7102 View commit details
    Browse the repository at this point in the history
  2. Allow responses to be sent on the same connection.

    Roman S. Borschel committed Feb 16, 2020
    Configuration menu
    Copy the full SHA
    ae6bfe9 View commit details
    Browse the repository at this point in the history
  3. Remove unnecessary remainders of inject_replaced.

    Roman S. Borschel committed Feb 16, 2020
    Configuration menu
    Copy the full SHA
    df6c55a View commit details
    Browse the repository at this point in the history

Commits on Feb 17, 2020

  1. Update swarm/src/behaviour.rs

    Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>
    romanb and tomaka authored Feb 17, 2020
    Configuration menu
    Copy the full SHA
    0ae2400 View commit details
    Browse the repository at this point in the history
  2. Update swarm/src/lib.rs

    Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>
    romanb and tomaka authored Feb 17, 2020
    Configuration menu
    Copy the full SHA
    1b3c9cf View commit details
    Browse the repository at this point in the history
  3. Update core/src/connection/manager.rs

    Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>
    romanb and tomaka authored Feb 17, 2020
    Configuration menu
    Copy the full SHA
    76fd5d9 View commit details
    Browse the repository at this point in the history
  4. Update core/src/connection/manager.rs

    Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>
    romanb and tomaka authored Feb 17, 2020
    Configuration menu
    Copy the full SHA
    4c81357 View commit details
    Browse the repository at this point in the history
  5. Update core/src/connection/pool.rs

    Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>
    romanb and tomaka authored Feb 17, 2020
    Configuration menu
    Copy the full SHA
    0e836fc View commit details
    Browse the repository at this point in the history
  6. Incorporate more review feedback.

    Roman S. Borschel committed Feb 17, 2020
    Configuration menu
    Copy the full SHA
    38f283d View commit details
    Browse the repository at this point in the history
  7. Move module declaration below imports.

    Roman S. Borschel committed Feb 17, 2020
    Configuration menu
    Copy the full SHA
    f3bfe54 View commit details
    Browse the repository at this point in the history
  8. Update core/src/connection/manager.rs

    Co-Authored-By: Toralf Wittner <tw@dtex.org>
    romanb and twittner authored Feb 17, 2020
    Configuration menu
    Copy the full SHA
    b0b39fb View commit details
    Browse the repository at this point in the history
  9. Update core/src/connection/manager.rs

    Co-Authored-By: Toralf Wittner <tw@dtex.org>
    romanb and twittner authored Feb 17, 2020
    Configuration menu
    Copy the full SHA
    53810e6 View commit details
    Browse the repository at this point in the history

Commits on Feb 18, 2020

  1. Simplify as per review.

    Roman S. Borschel committed Feb 18, 2020
    Configuration menu
    Copy the full SHA
    017d0e9 View commit details
    Browse the repository at this point in the history
  2. Fix rustoc link.

    Roman S. Borschel committed Feb 18, 2020
    Configuration menu
    Copy the full SHA
    f95a1dd View commit details
    Browse the repository at this point in the history
  3. Add try_notify_handler and simplify.

    Roman S. Borschel committed Feb 18, 2020
    Configuration menu
    Copy the full SHA
    21e9919 View commit details
    Browse the repository at this point in the history
  4. Relocate DialingConnection and DialingAttempt.

    For better visibility constraints.
    Roman S. Borschel committed Feb 18, 2020
    Configuration menu
    Copy the full SHA
    0a34b93 View commit details
    Browse the repository at this point in the history

Commits on Feb 19, 2020

  1. Small cleanup.

    Roman S. Borschel committed Feb 19, 2020
    Configuration menu
    Copy the full SHA
    efa5fde View commit details
    Browse the repository at this point in the history

Commits on Feb 20, 2020

  1. Merge branch 'master' into multicon

    Roman S. Borschel committed Feb 20, 2020
    Configuration menu
    Copy the full SHA
    73d6241 View commit details
    Browse the repository at this point in the history

Commits on Feb 23, 2020

  1. Small cleanup. More robust EstablishedConnectionIter.

    Roman S. Borschel committed Feb 23, 2020
    Configuration menu
    Copy the full SHA
    92d20e8 View commit details
    Browse the repository at this point in the history
  2. Clarify semantics of DialingPeer::connect.

    Roman S. Borschel committed Feb 23, 2020
    Configuration menu
    Copy the full SHA
    3540588 View commit details
    Browse the repository at this point in the history

Commits on Feb 24, 2020

  1. Don't call inject_disconnected on InvalidPeerId.

    To preserve the previous behavior and ensure calls to
    `inject_disconnected` are always paired with calls to
    `inject_connected`.
    Roman S. Borschel committed Feb 24, 2020
    Configuration menu
    Copy the full SHA
    3838c5e View commit details
    Browse the repository at this point in the history
  2. Provide public ConnectionId constructor.

    Mainly needed for testing purposes, e.g. in substrate.
    Roman S. Borschel committed Feb 24, 2020
    Configuration menu
    Copy the full SHA
    d9938b8 View commit details
    Browse the repository at this point in the history
  3. Move the established connection limit check to the right place.

    Roman S. Borschel committed Feb 24, 2020
    Configuration menu
    Copy the full SHA
    1d251d6 View commit details
    Browse the repository at this point in the history
  4. Clean up connection error handling.

    Separate connection errors into those occuring during
    connection setup or upon rejecting a newly established
    connection (the `PendingConnectionError`) and those
    errors occurring on previously established connections,
    i.e. for which a `ConnectionEstablished` event has
    been emitted by the connection pool earlier.
    Roman S. Borschel committed Feb 24, 2020
    Configuration menu
    Copy the full SHA
    6161f1c View commit details
    Browse the repository at this point in the history

Commits on Feb 25, 2020

  1. Revert change in log level and clarify an invariant.

    Roman S. Borschel committed Feb 25, 2020
    Configuration menu
    Copy the full SHA
    1a5b184 View commit details
    Browse the repository at this point in the history
  2. Remove inject_replaced entirely.

    Roman S. Borschel committed Feb 25, 2020
    Configuration menu
    Copy the full SHA
    df58cde View commit details
    Browse the repository at this point in the history

Commits on Feb 26, 2020

  1. Allow notifying all connection handlers.

    Thereby simplify by introducing a new enum `NotifyHandler`,
    used with a single constructor `NetworkBehaviourAction::NotifyHandler`.
    Roman S. Borschel committed Feb 26, 2020
    Configuration menu
    Copy the full SHA
    abf249b View commit details
    Browse the repository at this point in the history
  2. Merge branch 'master' into multicon

    Roman S. Borschel committed Feb 26, 2020
    Configuration menu
    Copy the full SHA
    b7d6c58 View commit details
    Browse the repository at this point in the history

Commits on Feb 28, 2020

  1. Merge branch 'master' into multicon

    Roman S. Borschel committed Feb 28, 2020
    Configuration menu
    Copy the full SHA
    7fe86db View commit details
    Browse the repository at this point in the history

Commits on Feb 29, 2020

  1. Finishing touches.

    Small API simplifications and code deduplication.
    Some more useful debug logging.
    Roman S. Borschel committed Feb 29, 2020
    Configuration menu
    Copy the full SHA
    3879b65 View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2020

  1. Configuration menu
    Copy the full SHA
    86cf85b View commit details
    Browse the repository at this point in the history