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

fix(swarm)!: make on_connection_handler_event impl mandatory. #3364

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions swarm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@
- Add `estblished_in` to `SwarmEvent::ConnectionEstablished`. See [PR 3134].

- Remove deprecated `inject_*` methods from `NetworkBehaviour` and `ConnectionHandler`.
see [PR 3264].
Make the implementation of `on_swarm_event` and `on_connection_handler_event`
both mandatory. See [PR 3264] and [PR 3364].
Comment on lines +12 to +13
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Make the implementation of `on_swarm_event` and `on_connection_handler_event`
both mandatory. See [PR 3264] and [PR 3364].
Make the implementation of `on_connection_handler_event`
mandatory and thus consistent with `on_swarm_event`. See [PR 3264] and [PR 3364].

I find the wording hard to understand, i.e. I would expect this change to touch both methods, whereas in reality it doesn't.

Copy link
Member Author

Choose a reason for hiding this comment

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

sorry for the confusion introduced Max. It does, it's just that for on_connection_handler_event it was left out on #3264. Does the CHANGELOG entry make more sense to you, or do you still want me to adress it?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, right, my bad. Thanks for clarifying.


- Update to `libp2p-swarm-derive` `v0.32.0`.

- Remove type parameter from `PendingOutboundConnectionError` and `PendingInboundConnectionError`.
These two types are always used with `std::io::Error`. See [PR 3272].

- Replace `SwarmBuilder::connection_event_buffer_size` with `SwarmBuilder::per_connection_event_buffer_size` .
- Replace `SwarmBuilder::connection_event_buffer_size` with `SwarmBuilder::per_connection_event_buffer_size` .
The configured value now applies _per_ connection.
The default values remains 7.
If you have previously set `connection_event_buffer_size` you should re-evaluate what a good size for a _per connection_ buffer is.
See [PR 3188].

[PR 3364]: https://github.com/libp2p/rust-libp2p/pull/3364
[PR 3170]: https://github.com/libp2p/rust-libp2p/pull/3170
[PR 3134]: https://github.com/libp2p/rust-libp2p/pull/3134
[PR 3153]: https://github.com/libp2p/rust-libp2p/pull/3153
Expand Down
3 changes: 1 addition & 2 deletions swarm/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ pub trait NetworkBehaviour: 'static {
_connection_id: ConnectionId,
_event: <<Self::ConnectionHandler as IntoConnectionHandler>::Handler as
ConnectionHandler>::OutEvent,
) {
}
);

/// Polls for things that swarm should do.
///
Expand Down