384 Commits

Author SHA1 Message Date
João Oliveira
8bd5d40927 chore: prepare v0.13.3 (#192) 2024-06-07 21:30:21 +01:00
KOVACS Krisztian
4e80263841 fix: wake up readers after setting the state to RecvClosed (#190)
Readers should be woken up after setting the state to RecvClosed otherwise
they potentially miss reading the EOF entirely.
2024-06-07 18:06:28 +01:00
Yiannis Marangos
5709e1b45c deps: Use web-time instead of instant (#191) 2024-06-07 17:49:59 +01:00
João Oliveira
24561a62ba Prepare v0.12.2 (#187)
Co-authored-by: Max Inden <mail@max-inden.de>
2024-04-30 19:41:08 +01:00
João Oliveira
460baf2ccb Merge pull request from GHSA-3999-5ffv-wp2r
feat: switch pending_frames VecDequeue for an Option to bound it
2024-04-30 18:58:49 +01:00
João Oliveira
af8f6935c1 address new review 2024-03-22 17:57:30 +00:00
João Oliveira
e154864766 address review 2024-03-15 14:47:35 +00:00
João Oliveira
286728026d use pending_read_frame and pending_write_frame separately 2024-03-13 14:32:31 +00:00
João Oliveira
297e9eba1f set pending_frame on main poll,
- so that it's clear we are replacing a None `pending_frame`

change the order of the closing state to allow flushing the pending frames first,
and not override a pending frame with a closing one from the receiver streams
2024-03-04 12:18:13 +00:00
João Oliveira
61003c53ce feat: switch pending_frames
VecDequeue for an Option to bound it
2024-02-28 23:00:59 +00:00
GitHub
cf6456f55f chore: Update .github/workflows/stale.yml [skip ci] 2024-01-31 16:50:44 +00:00
dependabot[bot]
461e695daf build(deps): Update env_logger requirement from 0.10 to 0.11 (#184)
Updates the requirements on [env_logger](https://github.com/rust-cli/env_logger) to permit the latest version.
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/env_logger/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-21 11:37:58 -08:00
Max Inden
618b141786 fix(wasm): use instant::{Duration, Instant} (#182) 2023-12-06 19:07:09 +01:00
Max Inden
68a9e3d079 feat: auto-tune (dynamic) stream receive window (#176)
- Send Yamux' Pings on an interval to measure the connection round-trip-time.
- Dynamically grow the stream receive window based on the round-trip-time and the estimated bandwidth.
2023-12-06 13:24:22 +01:00
Max Inden
16ffe54b1c chore: remove WindowUpdateMode::OnReceive (#179)
Follow up to previous deprecation https://github.com/libp2p/rust-yamux/pull/177.

Fixes https://github.com/libp2p/rust-yamux/issues/175.
2023-11-27 13:53:09 +01:00
Max Inden
1e46505721 chore: fix minor warnings (#181) 2023-11-25 10:13:16 +01:00
Max Inden
e0b0f495cf chore: move to Rust edition 2021 (#180) 2023-11-25 10:12:55 +01:00
Max Inden
b2528d836f chore: deprecate WindowUpdateMode::OnReceive (#177)
Continuation of https://github.com/libp2p/rust-yamux/pull/120.

Preparation for https://github.com/libp2p/rust-yamux/issues/175.

Also removes dead-lock warning for `WindowUpdateMode::OnRead`. With the restructuring of
`Connection::poll`, one reads from the socket when writing is blocked. Thus the deadlock can not
occur.
2023-11-24 10:30:37 +01:00
dependabot[bot]
93b70626f7 build(deps): Bump actions/checkout from 3 to 4 (#173)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 09:38:35 +10:00
Hung-I Wang
d0d9d6689e docs: remove mentions of old API components (#172)
Co-authored-by: Max Inden <mail@max-inden.de>
2023-08-20 13:29:21 +02:00
Max Inden
fa0429ba07 chore: prepare v0.12.0 (#169) 2023-07-20 13:27:39 +02:00
Andrew Schran
dcff3d5bf4 fix: garbage collect Stream when dropped (#167)
This fixes issue #166 where a `Stream` would never be removed
until its connection is closed, given that the `Connection` holds a
copy of the stream `Sender`.

Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2023-07-11 05:24:53 +02:00
Thomas Eizinger
e7c17ff667 feat: don't allow to open more than 256 unacknowledged streams (#153)
Co-authored-by: Max Inden <mail@max-inden.de>
2023-07-09 11:12:38 +02:00
Thomas Eizinger
69404a1b9d feat: remove Control and ControlledConnection (#164) 2023-07-03 15:28:24 +01:00
dependabot[bot]
34dcb97a6e build(deps): Update futures_ringbuf requirement from 0.3.1 to 0.4.0 (#161)
Updates the requirements on [futures_ringbuf](https://github.com/najamelan/futures_ringbuf) to permit the latest version.
- [Changelog](https://github.com/najamelan/futures_ringbuf/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/najamelan/futures_ringbuf/compare/0.3.1...0.4.0)

---
updated-dependencies:
- dependency-name: futures_ringbuf
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-06 05:14:28 +02:00
Thomas Eizinger
93d8638425 refactor: move more tests to poll-API based interface (#158) 2023-05-29 05:55:45 +02:00
Max Inden
fe95d02d72 chore: prepare v0.11.1 (#160) 2023-05-26 02:10:09 +02:00
Thomas Eizinger
52c725b365 fix: avoid race condition between pending frames and closing stream (#156)
Currently, we have a `garbage_collect` function that checks whether any of our
streams have been dropped. This can cause a race condition where the channel
between a `Stream` and the `Connection` still has pending frames for a stream
but dropping a stream causes us to already send a `FIN` flag for the stream.

We fix this by maintaining a single channel for each stream. When a stream gets
dropped, the `Receiver` becomes disconnected. We use this information to queue
the correct frame (`FIN` vs `RST`) into the buffer. At this point, all previous
frames have already been processed and the race condition is thus not present.

Additionally, this also allows us to implement `Stream::poll_flush` by
forwarding to the underlying `Sender`. Note that at present day, this only
checks whether there is _space_ in the channel, not whether the items have been
emitted by the `Receiver`.

We have a PR upstream that might fix this:
https://github.com/rust-lang/futures-rs/pull/2746

Fixes: #117.
2023-05-24 04:34:11 +02:00
dependabot[bot]
88ed4dfc7a build(deps): Update criterion requirement from 0.4 to 0.5 (#159)
Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs) to permit the latest version.
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bheisler/criterion.rs/compare/0.4.0...0.5.0)

---
updated-dependencies:
- dependency-name: criterion
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-24 04:15:15 +02:00
dependabot[bot]
72ccd5734f build(deps): Bump actions/stale from 6 to 7 (#151)
Bumps [actions/stale](https://github.com/actions/stale) from 6 to 7.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-30 13:25:46 +01:00
Max Inden
401e597d8b fix: Remove dead link to README.md (#148)
Release fails with the below otherwise:

```
error: failed to read `readme` file for package `yamux v0.11.0 (/home/xxx/rust-yamux/yamux)`
```
2022-12-01 21:41:32 +01:00
Max Inden
5d48c22c8d chore: Prepare v0.11.0 (#147) 2022-12-01 21:33:16 +01:00
dependabot[bot]
2bf70639dc build(deps): Update env_logger requirement from 0.9 to 0.10 (#146)
Updates the requirements on [env_logger](https://github.com/rust-cli/env_logger) to permit the latest version.
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/env_logger/compare/v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-01 18:12:20 +01:00
Thomas Eizinger
e59d8a55cf Merge pull request #142 from thomaseizinger/poll-style
Refactor `Connection` to a synchronous state machine
2022-11-26 09:06:03 +11:00
Thomas Eizinger
63938b1df3 Bump version and add changelog entry 2022-11-23 12:12:31 +11:00
Thomas Eizinger
1ca32e6248 Use doc link 2022-11-14 15:08:53 +11:00
Thomas Eizinger
27ed7ac5a6 Match exhaustively 2022-11-14 15:08:20 +11:00
Thomas Eizinger
1525cf804b Fix typo 2022-11-14 15:06:51 +11:00
Thomas Eizinger
654e38aef7 Remove comment and improve variable naming 2022-11-14 15:06:23 +11:00
Thomas Eizinger
a0ba23b2a4 Create workspace
This allows us to have a proper place for our test-harness.
2022-11-03 12:17:33 +11:00
Thomas Eizinger
3941cdc620 Add test for poll-based API
To reduce the duplication we split out a test harness.
2022-11-03 12:17:30 +11:00
Thomas Eizinger
79c14790a3 Make control as sister module of connection 2022-11-03 11:01:13 +11:00
Thomas Eizinger
0ac90a0805 Rewrite Control to be a layer on top of Connection 2022-11-03 11:01:12 +11:00
Thomas Eizinger
ce57e251fb Don't require T to be Send + 'static' 2022-11-03 10:42:11 +11:00
Thomas Eizinger
8279c27ea0 Implement connection cleanup as manual state machine 2022-11-03 10:42:11 +11:00
Thomas Eizinger
47c684bb35 Implement connection closing as manual state machine 2022-11-03 10:42:11 +11:00
Thomas Eizinger
2bae656904 Move Drop impl from Active to Connection 2022-11-03 10:42:11 +11:00
Thomas Eizinger
fe7d00056b Introduce Frame::close_stream ctor 2022-11-03 10:42:10 +11:00
Thomas Eizinger
7dcecdeda9 Handle ControlCommand outside of ConnectionState::poll 2022-11-03 10:42:10 +11:00
Thomas Eizinger
370f5bca07 Track reply sender outside of close function 2022-11-03 10:42:10 +11:00