Remove RwLock around individual peer instances (#1673)
* get rid of RwLock around peer instances * rustfmt * rename stuff to live_info * rustfmt * serialize into PeerInfoDisplay limit live_info write lock to peer_info.update() rename to PeerLiveInfo * simplify broadcast logic a bit more connected peers are connected by definition * return true/false on broadcast so we can send to more peers * rustfmt * fix p2p and server tests for PeerInfoDisplay * commit
This commit is contained in:
+3
-4
@@ -27,7 +27,7 @@ use core::core::hash::{Hash, Hashed};
|
||||
use core::core::{OutputFeatures, OutputIdentifier, Transaction};
|
||||
use core::ser;
|
||||
use p2p;
|
||||
use p2p::types::ReasonForBan;
|
||||
use p2p::types::{PeerInfoDisplay, ReasonForBan};
|
||||
use pool;
|
||||
use regex::Regex;
|
||||
use rest::*;
|
||||
@@ -405,11 +405,10 @@ pub struct PeersConnectedHandler {
|
||||
|
||||
impl Handler for PeersConnectedHandler {
|
||||
fn get(&self, _req: Request<Body>) -> ResponseFuture {
|
||||
let mut peers = vec![];
|
||||
let mut peers: Vec<PeerInfoDisplay> = vec![];
|
||||
for p in &w(&self.peers).connected_peers() {
|
||||
let p = p.read().unwrap();
|
||||
let peer_info = p.info.clone();
|
||||
peers.push(peer_info);
|
||||
peers.push(peer_info.into());
|
||||
}
|
||||
json_response(&peers)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user