Skip to content

Commit fdddacc

Browse files
authored
fix: allow relay to forward unlimited bytes
Allow relay to forward unlimited bytes from one peer to another by checking if `max_circuit_bytes` equals to 0 before checking if `bytes_sent` exceeds `max_circuit_bytes`. This will make current implementation follow the spec. May close #5170. Pull-Request: #5244.
1 parent 67ebcde commit fdddacc

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ libp2p-ping = { version = "0.44.0", path = "protocols/ping" }
9696
libp2p-plaintext = { version = "0.41.0", path = "transports/plaintext" }
9797
libp2p-pnet = { version = "0.24.0", path = "transports/pnet" }
9898
libp2p-quic = { version = "0.10.2", path = "transports/quic" }
99-
libp2p-relay = { version = "0.17.1", path = "protocols/relay" }
99+
libp2p-relay = { version = "0.17.2", path = "protocols/relay" }
100100
libp2p-rendezvous = { version = "0.14.0", path = "protocols/rendezvous" }
101101
libp2p-request-response = { version = "0.26.2", path = "protocols/request-response" }
102102
libp2p-server = { version = "0.12.7", path = "misc/server" }

protocols/relay/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.17.2
2+
3+
- Fix support for unlimited relay connection according to spec.
4+
See [PR 5244](https://github.com/libp2p/rust-libp2p/pull/5244).
5+
16
## 0.17.1
27

38
- Automatically register relayed addresses as external addresses.

protocols/relay/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "libp2p-relay"
33
edition = "2021"
44
rust-version = { workspace = true }
55
description = "Communications relaying for libp2p"
6-
version = "0.17.1"
6+
version = "0.17.2"
77
authors = ["Parity Technologies <[email protected]>", "Max Inden <[email protected]>"]
88
license = "MIT"
99
repository = "https://github.com/libp2p/rust-libp2p"

protocols/relay/src/copy_future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ where
7272
let this = &mut *self;
7373

7474
loop {
75-
if this.bytes_sent > this.max_circuit_bytes {
75+
if this.max_circuit_bytes > 0 && this.bytes_sent > this.max_circuit_bytes {
7676
return Poll::Ready(Err(io::Error::new(
7777
io::ErrorKind::Other,
7878
"Max circuit bytes reached.",

0 commit comments

Comments
 (0)