diff --git a/Cargo.lock b/Cargo.lock index c77b3e5e165..0a9ff52f9de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2720,7 +2720,7 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.45.2" +version = "0.45.3" dependencies = [ "arrayvec", "async-std", @@ -2969,7 +2969,7 @@ dependencies = [ [[package]] name = "libp2p-quic" -version = "0.10.1" +version = "0.10.2" dependencies = [ "async-std", "bytes", diff --git a/Cargo.toml b/Cargo.toml index 4f477e5c91a..dbb89afaed6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -83,7 +83,7 @@ libp2p-floodsub = { version = "0.44.0", path = "protocols/floodsub" } libp2p-gossipsub = { version = "0.46.1", path = "protocols/gossipsub" } libp2p-identify = { version = "0.44.1", path = "protocols/identify" } libp2p-identity = { version = "0.2.8" } -libp2p-kad = { version = "0.45.2", path = "protocols/kad" } +libp2p-kad = { version = "0.45.3", path = "protocols/kad" } libp2p-mdns = { version = "0.45.1", path = "protocols/mdns" } libp2p-memory-connection-limits = { version = "0.2.0", path = "misc/memory-connection-limits" } libp2p-metrics = { version = "0.14.1", path = "misc/metrics" } @@ -94,7 +94,7 @@ libp2p-perf = { version = "0.3.0", path = "protocols/perf" } libp2p-ping = { version = "0.44.0", 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.1", path = "transports/quic" } +libp2p-quic = { version = "0.10.2", path = "transports/quic" } libp2p-relay = { version = "0.17.1", path = "protocols/relay" } libp2p-rendezvous = { version = "0.14.0", path = "protocols/rendezvous" } libp2p-request-response = { version = "0.26.1", path = "protocols/request-response" } diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index 4740e4b1f95..b27a6943659 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.45.3 + +- The progress of the close query iterator shall be decided by ANY of the new peers. + See [PR 4932](https://github.com/libp2p/rust-libp2p/pull/4932). + ## 0.45.2 - Ensure `Multiaddr` handled and returned by `Behaviour` are `/p2p` terminated. diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index 1e4c788cf00..f4ad83972b4 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-kad" edition = "2021" rust-version = { workspace = true } description = "Kademlia protocol for libp2p" -version = "0.45.2" +version = "0.45.3" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/kad/src/query/peers/closest.rs b/protocols/kad/src/query/peers/closest.rs index 01155b7f010..dc913f1bbca 100644 --- a/protocols/kad/src/query/peers/closest.rs +++ b/protocols/kad/src/query/peers/closest.rs @@ -175,10 +175,14 @@ impl ClosestPeersIter { }, } - let num_closest = self.closest_peers.len(); - let mut progress = false; - // Incorporate the reported closer peers into the iterator. + // + // The iterator makes progress if: + // 1, the iterator did not yet accumulate enough closest peers. + // OR + // 2, any of the new peers is closer to the target than any peer seen so far + // (i.e. is the first entry after being incorporated) + let mut progress = self.closest_peers.len() < self.config.num_results.get(); for peer in closer_peers { let key = peer.into(); let distance = self.target.distance(&key); @@ -187,11 +191,8 @@ impl ClosestPeersIter { state: PeerState::NotContacted, }; self.closest_peers.entry(distance).or_insert(peer); - // The iterator makes progress if the new peer is either closer to the target - // than any peer seen so far (i.e. is the first entry), or the iterator did - // not yet accumulate enough closest peers. - progress = self.closest_peers.keys().next() == Some(&distance) - || num_closest < self.config.num_results.get(); + + progress = self.closest_peers.keys().next() == Some(&distance) || progress; } // Update the iterator state. diff --git a/transports/quic/CHANGELOG.md b/transports/quic/CHANGELOG.md index 2283c41262b..538db11d79e 100644 --- a/transports/quic/CHANGELOG.md +++ b/transports/quic/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.10.2 + +- Change `max_idle_timeout`to 10s. + See [PR XXXX](https://github.com/libp2p/rust-libp2p/pull/XXXX). + ## 0.10.1 - Allow disabling path MTU discovery. diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index 5f3fd5cfb43..3bf57dddb51 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-quic" -version = "0.10.1" +version = "0.10.2" authors = ["Parity Technologies "] edition = "2021" rust-version = { workspace = true } diff --git a/transports/quic/src/config.rs b/transports/quic/src/config.rs index 4e4bb94cd7a..540f13e726b 100644 --- a/transports/quic/src/config.rs +++ b/transports/quic/src/config.rs @@ -78,9 +78,9 @@ impl Config { server_tls_config, support_draft_29: false, handshake_timeout: Duration::from_secs(5), - max_idle_timeout: 30 * 1000, + max_idle_timeout: 10 * 1000, max_concurrent_stream_limit: 256, - keep_alive_interval: Duration::from_secs(15), + keep_alive_interval: Duration::from_secs(5), max_connection_data: 15_000_000, // Ensure that one stream is not consuming the whole connection.