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

transports/quic: Refactor Muxer and Connection #23

Merged
merged 97 commits into from
Sep 22, 2022

Conversation

elenaf9
Copy link

@elenaf9 elenaf9 commented Sep 22, 2022

Description

Replaces elenaf9#6, which targeted an outdated branch. See that PR for more info.

Links to any relevant issues

Part of libp2p#2883.

mxinden and others added 30 commits July 14, 2022 06:15
…ibp2p#2752)

Document that the `ConnectionHandler` implementation has to enforce a limit on
the number of inbound substreams.
…ibp2p#2734)

* misc/metrics: Explicitly delegate event recording to each recorder

This allows delegating a single event to multiple `Recorder`s. That enables e.g. the
`identify::Metrics` `Recorder` to act both on `IdentifyEvent` and `SwarmEvent`. The latter enables
it to garbage collect per peer data on disconnects.

* protocols/dcutr: Expose PROTOCOL_NAME

* protocols/identify: Expose PROTOCOL_NAME and PUSH_PROTOCOL_NAME

* protocols/ping: Expose PROTOCOL_NAME

* protocols/relay: Expose HOP_PROTOCOL_NAME and STOP_PROTOCOL_NAME

* misc/metrics: Track # connected nodes supporting specific protocol

An example metric exposed with this patch:

```
libp2p_identify_protocols{protocol="/ipfs/ping/1.0.0"} 10
```

This implies that 10 of the currently connected nodes support the ping protocol.
…nd,address_change,close}` (libp2p#2724)

Instead of having a mix of `poll_event`, `poll_outbound` and `poll_close`, we
flatten the entire interface of `StreamMuxer` into 4 individual functions:

- `poll_inbound`
- `poll_outbound`
- `poll_address_change`
- `poll_close`

This design is closer to the design of other async traits like `AsyncRead` and
`AsyncWrite`. It also allows us to delete the `StreamMuxerEvent`.
* build(deps): Bump Swatinem/rust-cache from 1.4.0 to 2.0.0

Bumps [Swatinem/rust-cache](https://github.com/Swatinem/rust-cache) from 1.4.0 to 2.0.0.
- [Release notes](https://github.com/Swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](Swatinem/rust-cache@cb2cf0c...6720f05)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Follow up on libp2p#2724. Given that
libp2p-core is bumped to v0.35.0, libp2p-tcp needs to be bumped as well.
….0 (libp2p#2761)

* build(deps): Update prometheus-client requirement from 0.16.0 to 0.17.0

Updates the requirements on [prometheus-client](https://github.com/prometheus/client_rust) to permit the latest version.
- [Release notes](https://github.com/prometheus/client_rust/releases)
- [Changelog](https://github.com/prometheus/client_rust/blob/master/CHANGELOG.md)
- [Commits](prometheus/client_rust@v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: prometheus-client
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
We are already boxing the given object so we might as well pin to
to avoid the `Unpin` trait bound.
…rBox` (libp2p#2775)

`StreamMuxerBox` is never shared across threads but owned by a single
connection. Restricting it to be `Sync` unnecessarily limits the design
space around the `StreamMuxer` trait and its implementations.
Generate `NetworkBehaviour::OutEvent` if not provided through
`#[behaviour(out_event = "MyOutEvent")]` and event processing is
disabled (default).
elenaf9 and others added 22 commits September 9, 2022 23:49
With if-watch `2.0.0` `IfWatcher::new` is not async anymore, hence the
`IfWatch` wrapping logic is obsolete.

Co-authored-by: Thomas Eizinger <[email protected]>
In case we accidentally generate the same port twice, we will try to
issue two dial attempts to the same address but also expect two dial
errors which is exactly what this test is trying to catch.
Unfortunately, the assertion is badly written and does not catch
duplicate inputs.
This patch fixes an issue where we couldn't use type parameters on a behaviour
with a custom out event that had different type parameters.
The existing implementation was based on an old API of the quinn_proto
Endpoint which by now has changed. In particular we can not explicitly
`accept` new connections on the endpoint anymore.
Instead if there is a new connections and our channel for new
connections is full because the endpoint is too busy, we now simply
drop the connection to backpressure the remote.
@kpp kpp merged commit 7f902b4 into kpp:libp2p-quic Sep 22, 2022
@elenaf9 elenaf9 changed the title transports/quic: Muxer and Connection transports/quic: Refactor Muxer and Connection Sep 22, 2022
@elenaf9 elenaf9 deleted the quic/muxer branch September 22, 2022 09:19
@mxinden
Copy link

mxinden commented Sep 22, 2022

🎉

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.