Skip to content

Commit 2ff9ebd

Browse files
remove rtt_actor, this is now done inside quinn on a per path basis
1 parent a6dfe4e commit 2ff9ebd

File tree

2 files changed

+24
-231
lines changed

2 files changed

+24
-231
lines changed

iroh/src/endpoint.rs

Lines changed: 24 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,6 @@ use n0_future::{time::Duration, Stream};
2828
use n0_watcher::Watcher;
2929
use nested_enum_utils::common_fields;
3030
use pin_project::pin_project;
31-
use snafu::{ensure, ResultExt, Snafu};
32-
use tracing::{debug, instrument, trace, warn};
33-
use url::Url;
34-
35-
#[cfg(wasm_browser)]
36-
use crate::discovery::pkarr::PkarrResolver;
37-
#[cfg(not(wasm_browser))]
38-
use crate::{discovery::dns::DnsDiscovery, dns::DnsResolver};
39-
use crate::{
40-
discovery::{
41-
pkarr::PkarrPublisher, ConcurrentDiscovery, Discovery, DiscoveryContext, DiscoveryError,
42-
DiscoveryItem, DiscoverySubscribers, DiscoveryTask, DynIntoDiscovery, IntoDiscovery,
43-
IntoDiscoveryError, Lagged, UserData,
44-
},
45-
magicsock::{self, Handle, NodeIdMappedAddr, OwnAddressSnafu},
46-
metrics::EndpointMetrics,
47-
net_report::Report,
48-
tls,
49-
};
50-
51-
mod rtt_actor;
52-
5331
// Missing still: SendDatagram and ConnectionClose::frame_type's Type.
5432
pub use quinn::{
5533
AcceptBi, AcceptUni, AckFrequencyConfig, ApplicationClose, Chunk, ClosedStream,
@@ -66,12 +44,29 @@ pub use quinn_proto::{
6644
},
6745
FrameStats, PathStats, TransportError, TransportErrorCode, UdpStats, Written,
6846
};
47+
use snafu::{ensure, ResultExt, Snafu};
48+
use tracing::{debug, instrument, trace, warn};
49+
use url::Url;
6950

70-
use self::rtt_actor::RttMessage;
7151
pub use super::magicsock::{
7252
AddNodeAddrError, ConnectionType, ControlMsg, DirectAddr, DirectAddrInfo, DirectAddrType,
7353
RemoteInfo, Source,
7454
};
55+
#[cfg(wasm_browser)]
56+
use crate::discovery::pkarr::PkarrResolver;
57+
#[cfg(not(wasm_browser))]
58+
use crate::{discovery::dns::DnsDiscovery, dns::DnsResolver};
59+
use crate::{
60+
discovery::{
61+
pkarr::PkarrPublisher, ConcurrentDiscovery, Discovery, DiscoveryContext, DiscoveryError,
62+
DiscoveryItem, DiscoverySubscribers, DiscoveryTask, DynIntoDiscovery, IntoDiscovery,
63+
IntoDiscoveryError, Lagged, UserData,
64+
},
65+
magicsock::{self, Handle, NodeIdMappedAddr, OwnAddressSnafu},
66+
metrics::EndpointMetrics,
67+
net_report::Report,
68+
tls,
69+
};
7570

7671
/// The delay to fall back to discovery when direct addresses fail.
7772
///
@@ -526,8 +521,6 @@ impl StaticConfig {
526521
pub struct Endpoint {
527522
/// Handle to the magicsocket/actor
528523
msock: Handle,
529-
/// Handle to the actor that resets the quinn RTT estimator
530-
rtt_actor: Arc<rtt_actor::RttHandle>,
531524
/// Configuration structs for quinn, holds the transport config, certificate setup, secret key etc.
532525
static_config: Arc<StaticConfig>,
533526
}
@@ -637,7 +630,6 @@ impl Endpoint {
637630
let metrics = msock.metrics.magicsock.clone();
638631
let ep = Self {
639632
msock,
640-
rtt_actor: Arc::new(rtt_actor::RttHandle::new(metrics)),
641633
static_config: Arc::new(static_config),
642634
};
643635
Ok(ep)
@@ -1623,7 +1615,6 @@ impl Future for IncomingFuture {
16231615
Poll::Ready(Err(err)) => Poll::Ready(Err(err)),
16241616
Poll::Ready(Ok(inner)) => {
16251617
let conn = Connection::new(inner, None, &this.ep);
1626-
try_send_rtt_msg(&conn, this.ep, None);
16271618
Poll::Ready(Ok(conn))
16281619
}
16291620
}
@@ -1710,19 +1701,18 @@ impl Connecting {
17101701
pub fn into_0rtt(self) -> Result<(Connection, ZeroRttAccepted), Self> {
17111702
match self.inner.into_0rtt() {
17121703
Ok((inner, zrtt_accepted)) => {
1704+
// This call is why `self.remote_node_id` was introduced.
1705+
// When we `Connecting::into_0rtt`, then we don't yet have `handshake_data`
1706+
// in our `Connection`, thus we won't be able to pick up
1707+
// `Connection::remote_node_id`.
1708+
// Instead, we provide `self.remote_node_id` here - we know it in advance,
1709+
// after all.
17131710
let conn = Connection::new(inner, self.remote_node_id, &self.ep);
17141711
let zrtt_accepted = ZeroRttAccepted {
17151712
inner: zrtt_accepted,
17161713
_discovery_drop_guard: self._discovery_drop_guard,
17171714
};
17181715

1719-
// This call is why `self.remote_node_id` was introduced.
1720-
// When we `Connecting::into_0rtt`, then we don't yet have `handshake_data`
1721-
// in our `Connection`, thus `try_send_rtt_msg` won't be able to pick up
1722-
// `Connection::remote_node_id`.
1723-
// Instead, we provide `self.remote_node_id` here - we know it in advance,
1724-
// after all.
1725-
try_send_rtt_msg(&conn, &self.ep, self.remote_node_id);
17261716
Ok((conn, zrtt_accepted))
17271717
}
17281718
Err(inner) => Err(Self {
@@ -1762,8 +1752,6 @@ impl Future for Connecting {
17621752
Poll::Ready(Err(err)) => Poll::Ready(Err(err)),
17631753
Poll::Ready(Ok(inner)) => {
17641754
let conn = Connection::new(inner, *this.remote_node_id, &this.ep);
1765-
1766-
try_send_rtt_msg(&conn, this.ep, *this.remote_node_id);
17671755
Poll::Ready(Ok(conn))
17681756
}
17691757
}
@@ -2138,30 +2126,6 @@ impl Connection {
21382126
}
21392127
}
21402128

2141-
/// Try send a message to the rtt-actor.
2142-
///
2143-
/// If we can't notify the actor that will impact performance a little, but we can still
2144-
/// function.
2145-
fn try_send_rtt_msg(conn: &Connection, magic_ep: &Endpoint, remote_node_id: Option<NodeId>) {
2146-
// If we can't notify the rtt-actor that's not great but not critical.
2147-
let Some(node_id) = remote_node_id.or_else(|| conn.remote_node_id().ok()) else {
2148-
warn!(?conn, "failed to get remote node id");
2149-
return;
2150-
};
2151-
let Some(conn_type_changes) = magic_ep.conn_type(node_id) else {
2152-
warn!(?conn, "failed to create conn_type stream");
2153-
return;
2154-
};
2155-
let rtt_msg = RttMessage::NewConnection {
2156-
connection: conn.inner.weak_handle(),
2157-
conn_type_changes: conn_type_changes.stream(),
2158-
node_id,
2159-
};
2160-
if let Err(err) = magic_ep.rtt_actor.msg_tx.try_send(rtt_msg) {
2161-
warn!(?conn, "rtt-actor not reachable: {err:#}");
2162-
}
2163-
}
2164-
21652129
/// Read a proxy url from the environment, in this order
21662130
///
21672131
/// - `HTTP_PROXY`

iroh/src/endpoint/rtt_actor.rs

Lines changed: 0 additions & 171 deletions
This file was deleted.

0 commit comments

Comments
 (0)