Thomas Eizinger
19ee6e8595
Add docs to state variants
2022-11-03 10:42:09 +11:00
Thomas Eizinger
527df19bb9
Rename Failing to Cleanup
...
Really what we are doing is cleaning up resources, not failing.
2022-11-03 10:42:09 +11:00
Thomas Eizinger
ff2708000b
Don't fail if connection got closed gracefully
2022-11-03 10:42:09 +11:00
Thomas Eizinger
bb96cd9a74
Improve docs
2022-11-03 10:42:08 +11:00
Thomas Eizinger
6ca0d1ff3e
Improve naming of poll fn on ConnectionState
...
This really polls for the next stream.
2022-11-03 10:42:08 +11:00
Thomas Eizinger
2df23f0cf6
Implement into_stream by directly calling poll_next
2022-11-03 10:42:08 +11:00
Thomas Eizinger
f9d3f4bbd0
Implement ConnectionState::poll
...
This makes `next_stream` now cancellation-safe.
2022-11-03 10:42:08 +11:00
Thomas Eizinger
527012d228
Don't pause control_receiver
...
Now that we are closing procedurally, we can just close it right
away instead of pausing and unpausing.
2022-11-03 10:42:07 +11:00
Thomas Eizinger
fd886eefd4
Implement shutdown procedurally
...
This is much easier to reason about than constant checking of state
as part of a loop.
2022-11-03 10:42:07 +11:00
Thomas Eizinger
a1db18ecaf
Inline on_close_connection
2022-11-03 10:42:07 +11:00
Thomas Eizinger
d63cde2250
Track closed state in connection state enum
2022-11-03 10:42:06 +11:00
Thomas Eizinger
f776a43671
Introduce internal ConnectionState enum
2022-11-03 10:42:05 +11:00
Thomas Eizinger
b37e48468a
Fail if we want to double close a connection
2022-11-03 10:40:53 +11:00
Thomas Eizinger
0ebd9cc376
Prioritise control and stream commands over reading the socket
2022-11-03 10:40:53 +11:00
Thomas Eizinger
3817398a2d
Split on_stream_command
2022-11-03 10:40:53 +11:00
Thomas Eizinger
5e6460959f
Use whitespace
2022-11-03 10:40:52 +11:00
Thomas Eizinger
3a6a37488d
Split on_control_command
2022-11-03 10:40:52 +11:00
Thomas Eizinger
e02bdbc879
Minimise diff
2022-11-03 10:40:52 +11:00
Thomas Eizinger
c1e805dcb2
Introduce Connection::poll function
2022-11-03 10:40:51 +11:00
Thomas Eizinger
6a55933cff
Remove async from a bunch of functions
...
We can do this by having a centralised place to send messages and
shoving them into this buffer in all other places.
2022-11-03 10:40:51 +11:00
Thomas Eizinger
d5d5ef4bb6
Handle GoAway logic outside of on_stream_command
2022-11-03 10:40:51 +11:00
Thomas Eizinger
6234e6f38d
Handle socket closing outside of on_control_command
2022-11-03 10:40:50 +11:00
Thomas Eizinger
54296c55cf
Make gargabe_collect not async
2022-11-03 10:40:50 +11:00
Thomas Eizinger
9af35b8eb2
Remove unnecessary Option
2022-11-03 10:40:50 +11:00
Thomas Eizinger
9bd4a3497a
Fix clippy warnings
2022-11-03 10:40:47 +11:00
Thomas Eizinger
2fcc56712a
tests/: Refactor ( #145 )
...
* Move tests to `tests/`
This ensures we are only accessing the public API of the crate.
* Inline `rt` variable to reduce noise
* Reduce error handling bloat
* Remove unnecessary qualification
* Reduce duplication between tests
* Introduce `noop_server`
* Don't use join! macro
* Assert received message as we receive it
* Inline `iter` variable
* Use `impl Trait` syntax
* Change to `IntoIterator`
This is a more flexible API.
* Unpack `Msg` in functions
This makes for a cleaner call-site.
* Use `?` in proptests
* Use `echo_server` in `write_deadlock`
* Use `noop_server` in `write_deadlock`
* Remove comment about ignored test as it clearly works
* Remove duplication between `send_recv` and `send_recv_single`
* Rename functions
* Move test to the top of the file
* Extract setup in `concurrent_streams` into helper
* Extract `echo_server` helper
* Introduce `noop_server`
* Refactor roundtrip fn to not use channels
* Extract `send_recv_data` helper
* Inline `roundtrip` function
2022-11-02 18:46:02 +00:00
dependabot[bot]
04e42d9434
build(deps): Bump actions/stale from 5 to 6 ( #141 )
...
Bumps [actions/stale](https://github.com/actions/stale ) from 5 to 6.
- [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/v5...v6 )
---
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-09-22 17:57:27 +02:00
dependabot[bot]
2688277d30
build(deps): Bump actions/stale from 3 to 5 ( #140 )
...
Bumps [actions/stale](https://github.com/actions/stale ) from 3 to 5.
- [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/v3...v5 )
---
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-09-21 15:20:15 +02:00
libp2p-mgmt-read-write[bot]
596339fde3
chore: Update .github/workflows/stale.yml [skip ci]
2022-09-19 13:40:36 +00:00
dependabot[bot]
a8d7753892
build(deps): Update criterion requirement from 0.3 to 0.4 ( #139 )
...
Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs ) to permit the latest version.
- [Release notes](https://github.com/bheisler/criterion.rs/releases )
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md )
- [Commits](https://github.com/bheisler/criterion.rs/compare/0.3.0...0.4.0 )
---
updated-dependencies:
- dependency-name: criterion
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-09-15 23:44:00 +02:00
Max Inden
e6e10f8262
src/connection: Process command or socket result immediately ( #138 )
...
> The `frame` future might be _ready_ with an `Error` from the underlying
socket (i.e. here `libp2p-websocket`). Though given that the result of the
`control_command` `Future` is handled first, `on_control_command` is called
despite `frame` having returned an `Error`. `on_control_command` itself may try
to write to the underlying socket, which will panic given that the socket
returned an error earlier via the `frame` `Future`.
With this patch, once any of `next_stream_command`, `next_control_command` or
`next_frame` `Future` is ready, the result is processed right away, without
additionally polling the remaining pending `Future`s, thus surfacing errors as
early as possible.
See https://github.com/libp2p/rust-libp2p/issues/2598 for details.
2022-08-05 08:43:10 +02:00
Thomas Eizinger
233199d775
*: Introduce rustfmt ( #134 )
2022-06-03 16:30:17 +02:00
Max Inden
dcf87521e8
*: Prepare v0.10.1 ( #133 )
2022-03-14 19:56:34 +01:00
dependabot[bot]
26ffadc576
build(deps): Bump actions/checkout from 2.4.0 to 3 ( #132 )
...
Bumps [actions/checkout](https://github.com/actions/checkout ) from 2.4.0 to 3.
- [Release notes](https://github.com/actions/checkout/releases )
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md )
- [Commits](https://github.com/actions/checkout/compare/v2.4.0...v3 )
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-02 11:26:52 +01:00
Max Inden
1cd84c8781
*: Prepare v0.10.1-rc.1 ( #131 )
2022-02-25 18:59:50 +01:00
Andre-Philippe Paquet
058010157e
src/connection: Flush socket while waiting for next frame
...
In #112 , flushing is no longer awaited, but instead, is called at each iteration
of the next loop in Connection. Unfortunately, when using wasm-ext with Noise,
frames may never get written until the next iteration is triggered by another
event (incoming frame or stream/control events).
The fix here is to make sure that flushing the I/O socket gets progressed in the
main loop.
2022-02-25 18:52:28 +01:00
dependabot[bot]
25e7d27860
build(deps): Update tokio-util requirement from 0.6 to 0.7 ( #129 )
...
Updates the requirements on [tokio-util](https://github.com/tokio-rs/tokio ) to permit the latest version.
- [Release notes](https://github.com/tokio-rs/tokio/releases )
- [Commits](https://github.com/tokio-rs/tokio/commits )
---
updated-dependencies:
- dependency-name: tokio-util
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-14 21:00:27 +01:00
dependabot[bot]
c475fb0b91
build(deps): update parking_lot requirement from 0.11 to 0.12 ( #126 )
...
* build(deps): update parking_lot requirement from 0.11 to 0.12
Updates the requirements on [parking_lot](https://github.com/Amanieu/parking_lot ) to permit the latest version.
- [Release notes](https://github.com/Amanieu/parking_lot/releases )
- [Changelog](https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md )
- [Commits](https://github.com/Amanieu/parking_lot/compare/0.11.0...0.12.0 )
---
updated-dependencies:
- dependency-name: parking_lot
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com >
* *: Bump version and add changelog entry
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de >
2022-01-31 15:22:57 +01:00
Max Inden
1c80ffbd6f
Merge remote-tracking branch 'libp2p/develop'
2022-01-13 17:24:05 +01:00
Max Inden
94a93eecc8
Merge pull request #125 from mxinden/prepare-v0.10.0
...
CHANGELOG: Prepare v0.10.0
2022-01-13 17:19:16 +01:00
Max Inden
b03804cc4c
CHANGELOG: Prepare v0.10.0
2022-01-11 11:37:52 +01:00
Max Inden
006ba63e63
Merge pull request #123 from libp2p/dependabot/github_actions/actions/checkout-2.4.0
...
build(deps): bump actions/checkout from 2.3.5 to 2.4.0
2021-11-03 17:21:14 +01:00
dependabot[bot]
c850b5364d
build(deps): bump actions/checkout from 2.3.5 to 2.4.0
...
Bumps [actions/checkout](https://github.com/actions/checkout ) from 2.3.5 to 2.4.0.
- [Release notes](https://github.com/actions/checkout/releases )
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md )
- [Commits](https://github.com/actions/checkout/compare/v2.3.5...v2.4.0 )
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2021-11-02 22:12:28 +00:00
Max Inden
4680f13826
Merge pull request #122 from libp2p/dependabot/github_actions/actions/checkout-2.3.5
...
build(deps): bump actions/checkout from 2.3.4 to 2.3.5
2021-10-18 18:08:32 +02:00
dependabot[bot]
d12d69e087
build(deps): bump actions/checkout from 2.3.4 to 2.3.5
...
Bumps [actions/checkout](https://github.com/actions/checkout ) from 2.3.4 to 2.3.5.
- [Release notes](https://github.com/actions/checkout/releases )
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md )
- [Commits](https://github.com/actions/checkout/compare/v2.3.4...v2.3.5 )
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
2021-10-15 22:07:31 +00:00
Max Inden
89a13656e2
Merge pull request #121 from libp2p/dependabot/cargo/env_logger-0.9
...
build(deps): update env_logger requirement from 0.8 to 0.9
2021-07-16 15:52:43 +02:00
dependabot[bot]
9444015d1c
build(deps): update env_logger requirement from 0.8 to 0.9
...
Updates the requirements on [env_logger](https://github.com/env-logger-rs/env_logger ) to permit the latest version.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases )
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md )
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.8.0...v0.9.0 )
---
updated-dependencies:
- dependency-name: env_logger
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com >
2021-07-14 22:07:58 +00:00
Max Inden
d3685da9fe
Merge pull request #120 from mxinden/default-on-read
...
src/lib: Default to WindowUpdateMode::OnRead
2021-06-08 10:33:28 +02:00
Max Inden
ab4fe4566e
src/lib: Default to WindowUpdateMode::OnRead
...
Default to `WindowUpdateMode::OnRead`, thus enabling full Yamux
flow-control, exercising back pressure on senders, preventing stream
resets due to reaching the buffer limit.
See the [`WindowUpdateMode` documentation] for details, especially the
section on deadlocking when sending data larger than the receivers
window.
[`WindowUpdateMode` documentation]: https://docs.rs/yamux/0.9.0/yamux/enum.WindowUpdateMode.html
2021-06-03 11:04:33 +02:00
Max Inden
e2368ec961
Merge pull request #119 from libp2p/dependabot/github_actions/actions/checkout-2.3.4
...
build(deps): bump actions/checkout from 2 to 2.3.4
2021-05-12 11:08:02 +02:00