The `HandlerWrapper` polls three components:
1. `ConnectionHandler`
2. Outbound negotiating streams
3. Inbound negotiating streams
The `ConnectionHandler` itself might itself poll already negotiated streams.
By polling the three components above in the listed order one:
- Prioritizes local work and work coming from negotiated streams over
negotiating streams.
- Prioritizes outbound negotiating streams over inbound negotiating
streams, i.e. outbound requests over inbound requests.
Replace `atomic::Atomic<u64>` by `std::sync::atomic:AtomicU64`.
The original motivation of using `atomic::Atomic<u64>` instead of
`std`'s version in #1670 was the following:
> I used the atomic crate and an Atomic<u64> because the AtomicU64 type
> isn't available on all architectures. The atomic crate automatically
> falls back to using a Mutex on platforms that don't support AtomicU64.
This argumentation is moot because the crate directly depends on
`libp2p-core` which also uses `AtomicU64`.
Have the main event loop (`Swarm::poll_next_event`) prioritize:
1. Work on `NetworkBehaviour` over work on `Pool`, thus prioritizing
local work over work coming from a remote.
2. Work on `Pool` over work on `ListenersStream`, thus prioritizing work
on existing connections over upgrading new incoming connections.
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Simplifies `PoolEvent`, no longer carrying a reference to an
`EstablishedConnection` or the `Pool`, but instead the `PeerId`,
`ConnectionId` and `ConnectedPoint` directly.
Co-authored-by: Elena Frank <elena.frank@protonmail.com>
Moves the score buckets to the metrics configuration, setting the same defaults
as what we had but also allowing the user to pass a reference to the score
thresholds to create them from that. Having them in the config also allows users
to set them directly.
Previously `libp2p-swarm` required a `Transport` to be `Clone`. Methods
on `Transport`, e.g. `Transport::dial` would take ownership, requiring
e.g. a `Clone::clone` before calling `Transport::dial`.
The requirement of `Transport` to be `Clone` is no longer needed in
`libp2p-swarm`. E.g. concurrent dialing can be done without a clone per
dial.
This commit removes the requirement of `Clone` for `Transport` in
`libp2p-swarm`. As a follow-up methods on `Transport` no longer take
ownership, but instead a mutable reference (`&mut self`).
On the one hand this simplifies `libp2p-swarm`, on the other it
simplifies implementations of `Transport`.
* build(deps): Update prost-build requirement from 0.9 to 0.10
Updates the requirements on [prost-build](https://github.com/tokio-rs/prost) to permit the latest version.
- [Release notes](https://github.com/tokio-rs/prost/releases)
- [Commits](https://github.com/tokio-rs/prost/commits)
---
updated-dependencies:
- dependency-name: prost-build
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
* .github/workflow: Don't run integration test in container
* .github/workflow: Don't run doc step in container
* .github/workflows: Remove component docs
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
* *: Import `libp2p` with `default-features = false`
While not a win in most cases, it reduces compile time for tests of
individual crates.
* Cargo.toml: Set features for examples