Allows Libp2p service to be read outside network thread

This commit is contained in:
Age Manning
2019-07-24 17:45:31 +10:00
parent 7d38cba252
commit ae96325c81
6 changed files with 47 additions and 56 deletions

View File

@@ -106,6 +106,11 @@ impl<TSubstream> Discovery<TSubstream> {
self.discovery.add_enr(enr);
}
/// The current number of connected libp2p peers.
pub fn connected_peers(&self) -> usize {
self.connected_peers.len()
}
/// Search for new peers using the underlying discovery mechanism.
fn find_peers(&mut self) {
// pick a random NodeId