Skip to content

Commit 3ec575a

Browse files
feat(quic): allow disabling of path MTU discovery
Path MTU discovery seems to be broken in QUIC right now on Windows and we had to disable it in Subspace. Related: autonomys/subspace#2195. Pull-Request: #4823. Co-authored-by: Shamil Gadelshin <[email protected]>
1 parent 441c242 commit 3ec575a

File tree

5 files changed

+21
-4
lines changed

5 files changed

+21
-4
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ libp2p-perf = { version = "0.3.0", path = "protocols/perf" }
9393
libp2p-ping = { version = "0.44.0", path = "protocols/ping" }
9494
libp2p-plaintext = { version = "0.41.0", path = "transports/plaintext" }
9595
libp2p-pnet = { version = "0.24.0", path = "transports/pnet" }
96-
libp2p-quic = { version = "0.10.0", path = "transports/quic" }
96+
libp2p-quic = { version = "0.10.1", path = "transports/quic" }
9797
libp2p-relay = { version = "0.17.0", path = "protocols/relay" }
9898
libp2p-rendezvous = { version = "0.14.0", path = "protocols/rendezvous" }
9999
libp2p-request-response = { version = "0.26.0", path = "protocols/request-response" }

transports/quic/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.10.1 - unreleased
2+
3+
- Allow disabling path MTU discovery.
4+
See [PR 4823](https://github.com/libp2p/rust-libp2p/pull/4823).
5+
16
## 0.10.0
27

38
- Improve hole-punch timing.

transports/quic/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "libp2p-quic"
3-
version = "0.10.0"
3+
version = "0.10.1"
44
authors = ["Parity Technologies <[email protected]>"]
55
edition = "2021"
66
rust-version = { workspace = true }

transports/quic/src/config.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1919
// DEALINGS IN THE SOFTWARE.
2020

21-
use quinn::VarInt;
21+
use quinn::{MtuDiscoveryConfig, VarInt};
2222
use std::{sync::Arc, time::Duration};
2323

2424
/// Config for the transport.
@@ -63,6 +63,9 @@ pub struct Config {
6363
server_tls_config: Arc<rustls::ServerConfig>,
6464
/// Libp2p identity of the node.
6565
keypair: libp2p_identity::Keypair,
66+
67+
/// Parameters governing MTU discovery. See [`MtuDiscoveryConfig`] for details.
68+
mtu_discovery_config: Option<MtuDiscoveryConfig>,
6669
}
6770

6871
impl Config {
@@ -83,8 +86,15 @@ impl Config {
8386
// Ensure that one stream is not consuming the whole connection.
8487
max_stream_data: 10_000_000,
8588
keypair: keypair.clone(),
89+
mtu_discovery_config: Some(Default::default()),
8690
}
8791
}
92+
93+
/// Disable MTU path discovery (it is enabled by default).
94+
pub fn disable_path_mtu_discovery(mut self) -> Self {
95+
self.mtu_discovery_config = None;
96+
self
97+
}
8898
}
8999

90100
/// Represents the inner configuration for [`quinn`].
@@ -108,6 +118,7 @@ impl From<Config> for QuinnConfig {
108118
support_draft_29,
109119
handshake_timeout: _,
110120
keypair,
121+
mtu_discovery_config,
111122
} = config;
112123
let mut transport = quinn::TransportConfig::default();
113124
// Disable uni-directional streams.
@@ -120,6 +131,7 @@ impl From<Config> for QuinnConfig {
120131
transport.allow_spin(false);
121132
transport.stream_receive_window(max_stream_data.into());
122133
transport.receive_window(max_connection_data.into());
134+
transport.mtu_discovery_config(mtu_discovery_config);
123135
let transport = Arc::new(transport);
124136

125137
let mut server_config = quinn::ServerConfig::with_crypto(server_tls_config);

0 commit comments

Comments
 (0)