mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 03:31:45 +00:00
## Proposed Changes
This reverts commit 53562010ec from PR #2724
Hopefully this will restore the reliability of the sync simulator.
This commit is contained in:
@@ -1646,7 +1646,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
warp_utils::reject::custom_bad_request("invalid peer id.".to_string())
|
||||
})?;
|
||||
|
||||
if let Some(peer_info) = network_globals.peers().peer_info(&peer_id) {
|
||||
if let Some(peer_info) = network_globals.peers.read().peer_info(&peer_id) {
|
||||
let address = if let Some(socket_addr) = peer_info.seen_addresses().next() {
|
||||
let mut addr = lighthouse_network::Multiaddr::from(socket_addr.ip());
|
||||
addr.push(lighthouse_network::multiaddr::Protocol::Tcp(
|
||||
@@ -1691,7 +1691,8 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
blocking_json_task(move || {
|
||||
let mut peers: Vec<api_types::PeerData> = Vec::new();
|
||||
network_globals
|
||||
.peers()
|
||||
.peers
|
||||
.read()
|
||||
.peers()
|
||||
.for_each(|(peer_id, peer_info)| {
|
||||
let address =
|
||||
@@ -1758,17 +1759,21 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
let mut disconnected: u64 = 0;
|
||||
let mut disconnecting: u64 = 0;
|
||||
|
||||
network_globals.peers().peers().for_each(|(_, peer_info)| {
|
||||
let state = api_types::PeerState::from_peer_connection_status(
|
||||
peer_info.connection_status(),
|
||||
);
|
||||
match state {
|
||||
api_types::PeerState::Connected => connected += 1,
|
||||
api_types::PeerState::Connecting => connecting += 1,
|
||||
api_types::PeerState::Disconnected => disconnected += 1,
|
||||
api_types::PeerState::Disconnecting => disconnecting += 1,
|
||||
}
|
||||
});
|
||||
network_globals
|
||||
.peers
|
||||
.read()
|
||||
.peers()
|
||||
.for_each(|(_, peer_info)| {
|
||||
let state = api_types::PeerState::from_peer_connection_status(
|
||||
peer_info.connection_status(),
|
||||
);
|
||||
match state {
|
||||
api_types::PeerState::Connected => connected += 1,
|
||||
api_types::PeerState::Connecting => connecting += 1,
|
||||
api_types::PeerState::Disconnected => disconnected += 1,
|
||||
api_types::PeerState::Disconnecting => disconnecting += 1,
|
||||
}
|
||||
});
|
||||
|
||||
Ok(api_types::GenericResponse::from(api_types::PeerCount {
|
||||
connected,
|
||||
@@ -2238,7 +2243,8 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
.and_then(|network_globals: Arc<NetworkGlobals<T::EthSpec>>| {
|
||||
blocking_json_task(move || {
|
||||
Ok(network_globals
|
||||
.peers()
|
||||
.peers
|
||||
.read()
|
||||
.peers()
|
||||
.map(|(peer_id, peer_info)| eth2::lighthouse::Peer {
|
||||
peer_id: peer_id.to_string(),
|
||||
@@ -2257,7 +2263,8 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
.and_then(|network_globals: Arc<NetworkGlobals<T::EthSpec>>| {
|
||||
blocking_json_task(move || {
|
||||
Ok(network_globals
|
||||
.peers()
|
||||
.peers
|
||||
.read()
|
||||
.connected_peers()
|
||||
.map(|(peer_id, peer_info)| eth2::lighthouse::Peer {
|
||||
peer_id: peer_id.to_string(),
|
||||
|
||||
Reference in New Issue
Block a user