LES Peer Info (#4195)

* connected peers function for network service

* get LES peer info in sync API

* new peer info in RPC
This commit is contained in:
Robert Habermeier
2017-01-20 12:41:49 +01:00
committed by Arkadiy Paronyan
parent 35666f718b
commit 3ff9324ec0
11 changed files with 150 additions and 48 deletions

View File

@@ -316,6 +316,12 @@ impl LightProtocol {
}
}
/// Attempt to get peer status.
pub fn peer_status(&self, peer: &PeerId) -> Option<Status> {
self.peers.read().get(&peer)
.map(|peer| peer.lock().status.clone())
}
/// Check the maximum amount of requests of a specific type
/// which a peer would be able to serve. Returns zero if the
/// peer is unknown or has no buffer flow parameters.