Skip to content

feat: remove Control and ControlledConnection#164

Merged
thomaseizinger merged 16 commits intolibp2p:masterfrom
thomaseizinger:feat/remove-control
Jul 3, 2023
Merged

feat: remove Control and ControlledConnection#164
thomaseizinger merged 16 commits intolibp2p:masterfrom
thomaseizinger:feat/remove-control

Conversation

@thomaseizinger
Copy link
Contributor

@thomaseizinger thomaseizinger commented Jun 28, 2023

To remove Control, we need to migrate all tests and benchmarks to use the new poll-based API. This is done at a best-effort basis.

There is likely a cleaner design for the tests but I wanted to minimize the amount of work we put into this library. What I wanted to get to is having #153 merged and implement #154.

Especially the benchmarks are somewhat dated I think we are better off using the new cross-implementation benchmarking infrastructure to check the performance of rust-yamux.

Resolves #157.

@thomaseizinger thomaseizinger changed the title refactor: move more tests to the poll-based API feat: remove Control and ControlledConnection Jun 30, 2023
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Thank you for all the clean-ups. Especially the big one, namely to remove the Control.

Comment on lines +108 to +118
pub struct MessageSender<T> {
connection: Connection<T>,
pending_messages: Vec<Msg>,
worker_streams: FuturesUnordered<BoxFuture<'static, ()>>,
streams_processed: usize,
/// Whether to spawn a new task for each stream.
spawn_tasks: bool,
/// How many times to send each message on the stream
message_multiplier: u64,
strategy: MessageSenderStrategy,
}
Copy link
Member

Choose a reason for hiding this comment

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

👍

Co-authored-by: Max Inden <[email protected]>
@thomaseizinger thomaseizinger merged commit 69404a1 into libp2p:master Jul 3, 2023
@thomaseizinger thomaseizinger deleted the feat/remove-control branch July 3, 2023 14:28
lexnv added a commit to paritytech/litep2p that referenced this pull request Jan 29, 2025
… API (#320)

This PR relies on the libp2p-yamux crate for the core functionality of
our multiplexer.
The main goal is to bring complete compatibility between libp2p and
litep2p on the yamux layer, and remove 90% of the yamux code in favor of
the upstream implementation while keeping the controller API in place.

The upstream crate brings in multiple fixes for substreams while
minimally impacting our dependency tree.

The downside of the upstream implementation is that the controller API
has been removed. Adjusting to the new API would be a massive breaking
change for all transport layers. Therefore, we keep the controller API
which integrates seamlessly with the upstream yamux. No other changes
were present to the controller API in the upstream implementation.

### Yamux changelog

The changelog includes the fixes from the upstream since the moment we
have inlined the crate in litep2p:

```
# 0.13.4

- Fix sending pending frames after closing. See [PR 194](libp2p/rust-yamux#194).

# 0.13.3

- Wake up readers after setting the state to RecvClosed to not miss EOF.
  See [PR 190](libp2p/rust-yamux#190).

- Use `web-time` instead of `instant`.
  See [PR 191](libp2p/rust-yamux#191).

# 0.13.2

- Bound `Active`'s `pending_frames` to enforce backpressure. 
  See [460baf2](libp2p/rust-yamux@460baf2)
  
# 0.13.1

- Fix WASM support using `instant::{Duration, Instant}` instead of `std::time::{Duration, Instant}`.
  See [PR 179](libp2p/rust-yamux#179).

# 0.13.0

- Introduce dynamic stream receive window auto-tuning.
  While low-resourced deployments maintain the benefit of small buffers, high resource deployments eventually end-up with a window of roughly the bandwidth-delay-product (ideal) and are thus able to use the entire available bandwidth.
  See [PR 176](libp2p/rust-yamux#176) for performance results and details on the implementation.
- Remove `WindowUpdateMode`.
  Behavior will always be `WindowUpdateMode::OnRead`, thus enabling flow-control and enforcing backpressure.
  See [PR 178](libp2p/rust-yamux#178).

# 0.12.1

- Deprecate `WindowUpdateMode::OnReceive`.
  It does not enforce flow-control, i.e. breaks backpressure.
  Use `WindowUpdateMode::OnRead` instead.
  See [PR #177](libp2p/rust-yamux#177).

# 0.12.0

- Remove `Control` and `ControlledConnection`.
  Users have to move to the `poll_` functions of `Connection`.
  See [PR #164](libp2p/rust-yamux#164).

- Fix a bug where `Stream`s would not be dropped until their corresponding `Connection` was dropped.
  See [PR #167](libp2p/rust-yamux#167).

```


### Next Steps
- [x] deployment in versi-net and monitor metrics / CPU impact
(extensively test this)


cc @paritytech/networking

---------

Signed-off-by: Alexandru Vasile <[email protected]>
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.

Remove ControlledConnection and everything around it

2 participants