mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-04-25 11:02:12 +00:00
Return iterator from local_closest_peers (#50)
This commit is contained in:
parent
43544e635a
commit
cc690f1fea
@ -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 <admin@parity.io>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/libp2p/rust-libp2p"
|
||||
|
@ -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 <admin@parity.io>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/libp2p/rust-libp2p"
|
||||
|
@ -591,11 +591,11 @@ where
|
||||
}
|
||||
|
||||
/// Returns closest peers to the given key; takes peers from local routing table
|
||||
pub fn local_closest_peers<K>(&mut self, key: K) -> Vec<WeightedPeer>
|
||||
pub fn local_closest_peers<'s, 'k : 's, K: 's>(&'s mut self, key: &'k kbucket::Key<K>)
|
||||
-> impl Iterator<Item = WeightedPeer> + 's
|
||||
where
|
||||
K: Into<kbucket::Key<K>> + Into<Vec<u8>> + Clone {
|
||||
let target: kbucket::Key<K> = 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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user