From cc690f1fea62a7beae3e5a3ad72b3afba3da63db Mon Sep 17 00:00:00 2001 From: folex <0xdxdy@gmail.com> Date: Wed, 9 Jun 2021 18:21:30 +0300 Subject: [PATCH] Return iterator from local_closest_peers (#50) --- Cargo.toml | 2 +- protocols/kad/Cargo.toml | 2 +- protocols/kad/src/behaviour.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 937e0999..dd1d0388 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "fluence-fork-libp2p" edition = "2018" description = "Peer-to-peer networking library" -version = "0.36.1" +version = "0.36.2" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index 8a00cc9d..f660b5b4 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -2,7 +2,7 @@ name = "fluence-fork-libp2p-kad" edition = "2018" description = "Kademlia protocol for libp2p" -version = "0.29.1" +version = "0.29.2" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/kad/src/behaviour.rs b/protocols/kad/src/behaviour.rs index 1ed6e97f..e630811e 100644 --- a/protocols/kad/src/behaviour.rs +++ b/protocols/kad/src/behaviour.rs @@ -591,11 +591,11 @@ where } /// Returns closest peers to the given key; takes peers from local routing table - pub fn local_closest_peers(&mut self, key: K) -> Vec + pub fn local_closest_peers<'s, 'k : 's, K: 's>(&'s mut self, key: &'k kbucket::Key) + -> impl Iterator + 's where K: Into> + Into> + Clone { - let target: kbucket::Key = key.into(); - Self::closest_keys(&mut self.kbuckets, &target).collect() + Self::closest_keys(&mut self.kbuckets, key) } /// Performs a lookup for a record in the DHT.