Skip to content

Commit

Permalink
feat(quic): allow setting the MTU discovery upper bound
Browse files Browse the repository at this point in the history
The default MTU discovery upper bound is too high for some environments and results in permanent warnings. As I'd like to be able to configure this setting, adding a new method for the `Config`.

Pull-Request: #5386.
  • Loading branch information
Wiezzel committed May 14, 2024
1 parent 6061172 commit 1aa016e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ libp2p-perf = { version = "0.3.0", path = "protocols/perf" }
libp2p-ping = { version = "0.44.1", path = "protocols/ping" }
libp2p-plaintext = { version = "0.41.0", path = "transports/plaintext" }
libp2p-pnet = { version = "0.24.0", path = "transports/pnet" }
libp2p-quic = { version = "0.10.2", path = "transports/quic" }
libp2p-quic = { version = "0.10.3", path = "transports/quic" }
libp2p-relay = { version = "0.17.2", path = "protocols/relay" }
libp2p-rendezvous = { version = "0.14.0", path = "protocols/rendezvous" }
libp2p-request-response = { version = "0.26.2", path = "protocols/request-response" }
Expand Down
4 changes: 4 additions & 0 deletions transports/quic/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.10.3
- Allow configuring MTU discovery upper bound.
See [PR 5386](https://github.com/libp2p/rust-libp2p/pull/5386).

## 0.10.2

- Change `max_idle_timeout`to 10s.
Expand Down
2 changes: 1 addition & 1 deletion transports/quic/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libp2p-quic"
version = "0.10.2"
version = "0.10.3"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
rust-version = { workspace = true }
Expand Down
12 changes: 10 additions & 2 deletions transports/quic/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ pub struct Config {
/// concurrently by the remote peer.
pub max_concurrent_stream_limit: u32,

/// Max unacknowledged data in bytes that may be send on a single stream.
/// Max unacknowledged data in bytes that may be sent on a single stream.
pub max_stream_data: u32,

/// Max unacknowledged data in bytes that may be send in total on all streams
/// Max unacknowledged data in bytes that may be sent in total on all streams
/// of a connection.
pub max_connection_data: u32,

Expand Down Expand Up @@ -90,6 +90,14 @@ impl Config {
}
}

/// Set the upper bound to the max UDP payload size that MTU discovery will search for.
pub fn mtu_upper_bound(mut self, value: u16) -> Self {
self.mtu_discovery_config
.get_or_insert_with(Default::default)
.upper_bound(value);
self
}

/// Disable MTU path discovery (it is enabled by default).
pub fn disable_path_mtu_discovery(mut self) -> Self {
self.mtu_discovery_config = None;
Expand Down

0 comments on commit 1aa016e

Please sign in to comment.