Skip to content

Commit 783e2ef

Browse files
refactor(iroh)!: remove Endpoint::latency (#3717)
## Description Based on #3593 This was always just a placeholder, and can now be collected using `EndpointHooks`. ## Breaking Changes - remove `Endpoint::latency` --------- Co-authored-by: varun-doshi <[email protected]>
1 parent e22c001 commit 783e2ef

File tree

3 files changed

+0
-50
lines changed

3 files changed

+0
-50
lines changed

iroh/src/endpoint.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -945,13 +945,6 @@ impl Endpoint {
945945
//
946946
// Partially they return things passed into the builder.
947947

948-
/// Returns the currently lowest latency for this endpoint.
949-
///
950-
/// Will return `None` if we do not have any address information for the given `endpoint_id`.
951-
pub async fn latency(&self, endpoint_id: EndpointId) -> Option<Duration> {
952-
self.msock.latency(endpoint_id).await
953-
}
954-
955948
/// Returns the DNS resolver used in this [`Endpoint`].
956949
///
957950
/// See [`Builder::dns_resolver`].

iroh/src/magicsock.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -391,18 +391,6 @@ impl MagicSock {
391391
})
392392
}
393393

394-
// TODO: Build better info to expose to the user about remote nodes. We probably want
395-
// to expose this as part of path information instead.
396-
pub(crate) async fn latency(&self, eid: EndpointId) -> Option<Duration> {
397-
let remote_state = self.remote_map.remote_state_actor(eid);
398-
let (tx, rx) = oneshot::channel();
399-
remote_state
400-
.send(RemoteStateMessage::Latency(tx))
401-
.await
402-
.ok();
403-
rx.await.unwrap_or_default()
404-
}
405-
406394
/// Stores a new set of direct addresses.
407395
///
408396
/// If the direct addresses have changed from the previous set, they are published to

iroh/src/magicsock/remote_map/remote_state.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,6 @@ impl RemoteStateActor {
348348
RemoteStateMessage::ResolveRemote(addrs, tx) => {
349349
self.handle_msg_resolve_remote(addrs, tx);
350350
}
351-
RemoteStateMessage::Latency(tx) => {
352-
self.handle_msg_latency(tx);
353-
}
354351
}
355352
}
356353

@@ -504,29 +501,6 @@ impl RemoteStateActor {
504501
self.trigger_discovery();
505502
}
506503

507-
/// Handles [`RemoteStateMessage::Latency`].
508-
fn handle_msg_latency(&self, tx: oneshot::Sender<Option<Duration>>) {
509-
let rtt = self.selected_path.get().and_then(|addr| {
510-
for conn_state in self.connections.values() {
511-
let Some(path_id) = conn_state.path_ids.get(&addr) else {
512-
continue;
513-
};
514-
if !conn_state.open_paths.contains_key(path_id) {
515-
continue;
516-
}
517-
if let Some(rtt) = conn_state
518-
.handle
519-
.upgrade()
520-
.and_then(|conn| conn.path_stats(*path_id).map(|stats| stats.rtt))
521-
{
522-
return Some(rtt);
523-
}
524-
}
525-
None
526-
});
527-
tx.send(rtt).ok();
528-
}
529-
530504
fn handle_discovery_item(&mut self, item: Option<Result<DiscoveryItem, DiscoveryError>>) {
531505
match item {
532506
None => {
@@ -1018,11 +992,6 @@ pub(crate) enum RemoteStateMessage {
1018992
BTreeSet<TransportAddr>,
1019993
oneshot::Sender<Result<(), DiscoveryError>>,
1020994
),
1021-
/// Returns the current latency to the remote endpoint.
1022-
///
1023-
/// TODO: This is more of a placeholder message currently. Check MagicSock::latency.
1024-
#[debug("Latency(..)")]
1025-
Latency(oneshot::Sender<Option<Duration>>),
1026995
}
1027996

1028997
/// A handle to a [`RemoteStateActor`].

0 commit comments

Comments
 (0)