summaryrefslogtreecommitdiffstats
path: root/src/api/peers.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/peers.rs')
-rw-r--r--src/api/peers.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/api/peers.rs b/src/api/peers.rs
index 9e907ac..cea3644 100644
--- a/src/api/peers.rs
+++ b/src/api/peers.rs
@@ -17,6 +17,7 @@ use crate::document::store;
use crate::locks::MutexExt;
use crate::state::{AppState, HelloState, Incidents, Liveness};
use crate::swarm::peer::forgotten_path;
+use crate::transport::Destination;
use crate::transport::traffic::PeerTraffic;
#[derive(Debug, Serialize)]
@@ -50,6 +51,9 @@ pub(crate) struct PeerStatus {
alias: Option<String>,
/// Where this node reaches it, or would (`Transport::addresses_of`).
addresses: Vec<String>,
+ /// Where messages to it go now: the address, whether the peer proved itself there,
+ /// and the connection there (libp2p: direct or relayed). Absent if nowhere.
+ destination: Option<Destination>,
validated_swarm: Option<String>,
status: PeerLivenessStatus,
handshake_complete: bool,
@@ -65,9 +69,6 @@ pub(crate) struct PeerStatus {
heads: Option<usize>,
/// We keep it alive and sync with it on our own; other peers we only answer.
neighbour: bool,
- /// Effective round-trip time in milliseconds (smoothed, raised by requests still
- /// unanswered); absent without a recent sample.
- rtt_ms: Option<f64>,
/// Messages and payload bytes exchanged with it, by kind, since we started (or
/// since it was last listed).
traffic: PeerTraffic,
@@ -120,10 +121,6 @@ pub(crate) async fn list_peers(
for (peer, peer_state_mutex) in snapshot {
let neighbour = crate::swarm::topology::is_neighbour(&state, &peer);
- let rtt_ms = state
- .lock_rtt()
- .effective(&peer, now, state.timing.rtt_fresh_for())
- .map(|rtt| rtt.as_secs_f64() * 1000.0);
let traffic = state.traffic.peer(&peer).unwrap_or_default();
let sync_throughput = state
.throughput
@@ -146,11 +143,13 @@ pub(crate) async fn list_peers(
let alias = aliases.remove(&peer);
let addresses = state.transport.addresses_of(&peer);
+ let destination = state.transport.destination(&peer);
peers.insert(
peer,
PeerStatus {
alias,
addresses,
+ destination,
validated_swarm: ps.standing.swarm_id().map(str::to_owned),
status,
handshake_complete: ps.hello_state == HelloState::Established,
@@ -163,7 +162,6 @@ pub(crate) async fn list_peers(
same_epoch: ps.epoch.map(|epoch| epoch == local_epoch),
heads: ps.reported_heads,
neighbour,
- rtt_ms,
traffic,
incidents: ps.incidents,
sync_throughput,