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

[mplex, yamux] Streamline configuration API. #1822

Merged
merged 3 commits into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion examples/ipfs-private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use libp2p::{
noise,
swarm::NetworkBehaviourEventProcess,
tcp::TcpConfig,
yamux::Config as YamuxConfig,
yamux::YamuxConfig,
Multiaddr, NetworkBehaviour, PeerId, Swarm, Transport,
};
use std::{
Expand Down
4 changes: 4 additions & 0 deletions muxers/mplex/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 0.24.0 [unreleased]

- Tweak the naming in the `MplexConfig` API for better
consistency with `libp2p-yamux`.
[PR 1822](https://github.com/libp2p/rust-libp2p/pull/1822).

- Update dependencies.

# 0.23.1 [2020-10-28]
Expand Down
8 changes: 4 additions & 4 deletions muxers/mplex/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ impl MplexConfig {
/// accumulates too quickly (judged by internal bounds), the
/// connection is closed with an error due to the misbehaved
/// remote.
pub fn max_substreams(&mut self, max: usize) -> &mut Self {
pub fn set_max_num_streams(&mut self, max: usize) -> &mut Self {
self.max_substreams = max;
self
}

/// Sets the maximum number of frames buffered per substream.
///
/// A limit is necessary in order to avoid DoS attacks.
pub fn max_buffer_len(&mut self, max: usize) -> &mut Self {
pub fn set_max_buffer_size(&mut self, max: usize) -> &mut Self {
self.max_buffer_len = max;
self
}
Expand All @@ -72,14 +72,14 @@ impl MplexConfig {
/// for a substream.
///
/// See the documentation of [`MaxBufferBehaviour`].
pub fn max_buffer_len_behaviour(&mut self, behaviour: MaxBufferBehaviour) -> &mut Self {
pub fn set_max_buffer_behaviour(&mut self, behaviour: MaxBufferBehaviour) -> &mut Self {
self.max_buffer_behaviour = behaviour;
self
}

/// Sets the frame size used when sending data. Capped at 1Mbyte as per the
/// Mplex spec.
pub fn split_send_size(&mut self, size: usize) -> &mut Self {
pub fn set_split_send_size(&mut self, size: usize) -> &mut Self {
let size = cmp::min(size, MAX_FRAME_SIZE);
self.split_send_size = size;
self
Expand Down
4 changes: 4 additions & 0 deletions muxers/yamux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 0.27.0 [unreleased]

- Tweak the naming in the `MplexConfig` API for better
consistency with `libp2p-mplex`.
[PR 1822](https://github.com/libp2p/rust-libp2p/pull/1822).

- Update dependencies.

# 0.26.0 [2020-10-16]
Expand Down
Loading