Skip to content

Commit 57c8f51

Browse files
committed
Merge remote-tracking branch 'origin/feat-multipath' into Frando/qlog-latest
2 parents 41ac3d1 + 1d6e453 commit 57c8f51

File tree

7 files changed

+458
-38
lines changed

7 files changed

+458
-38
lines changed

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ iroh-quinn = { git = "https://github.com/n0-computer/quinn", branch = "Frando/ql
4747
iroh-quinn-proto = { git = "https://github.com/n0-computer/quinn", branch = "Frando/qlog-latest-multipath" }
4848
iroh-quinn-udp = { git = "https://github.com/n0-computer/quinn", branch = "Frando/qlog-latest-multipath" }
4949

50-
netwatch = { git = "https://github.com/n0-computer/net-tools", branch = "Frando/quinn-qlog" }
51-
portmapper = { git = "https://github.com/n0-computer/net-tools", branch = "Frando/quinn-qlog" }
50+
netwatch = { git = "https://github.com/n0-computer/net-tools", branch = "main" }
5251

5352
# iroh-quinn = { path = "../quinn/quinn" }
5453
# iroh-quinn-proto = { path = "../quinn/quinn-proto" }

iroh/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,14 @@ wasm-bindgen-test = "0.3"
146146
cfg_aliases = { version = "0.2.1" }
147147

148148
[features]
149-
default = ["metrics"]
149+
default = ["metrics", "fast-apple-datapath"]
150150
metrics = ["iroh-metrics/metrics", "iroh-relay/metrics", "portmapper/metrics"]
151151
test-utils = ["iroh-relay/test-utils", "iroh-relay/server", "dep:axum"]
152152
discovery-local-network = ["dep:swarm-discovery"]
153153
discovery-pkarr-dht = ["pkarr/dht"]
154154
qlog = ["quinn/qlog"]
155+
# Use private Apple APIs to send multiple packets in a single syscall.
156+
fast-apple-datapath = ["quinn/fast-apple-datapath"]
155157

156158
[package.metadata.docs.rs]
157159
all-features = true

iroh/bench/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ tracing-subscriber = { version = "0.3.0", default-features = false, features = [
2828
] }
2929

3030
[features]
31-
default = ["metrics"]
31+
default = ["metrics", "fast-apple-datapath"]
3232
metrics = ["iroh/metrics", "iroh-metrics"]
3333
local-relay = ["iroh/test-utils"]
34+
# Use private Apple APIs to send multiple packets in a single syscall.
35+
fast-apple-datapath = ["iroh/fast-apple-datapath", "quinn/fast-apple-datapath"]

iroh/src/magicsock/remote_map.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,6 @@ pub enum Source {
185185
_0: Private,
186186
},
187187
/// We established a connection on this address.
188-
///
189-
/// Currently this means the path was in uses as [`PathId::ZERO`] when the a connection
190-
/// was added to the `RemoteStateActor`.
191-
///
192-
/// [`PathId::ZERO`]: quinn_proto::PathId::ZERO
193188
#[strum(serialize = "Connection")]
194189
Connection {
195190
/// private marker

iroh/src/magicsock/remote_map/remote_state.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,6 @@ const HOLEPUNCH_ATTEMPTS_INTERVAL: Duration = Duration::from_secs(5);
5050
mod guarded_channel;
5151
mod path_state;
5252

53-
// TODO: use this
54-
// /// Number of addresses that are not active that we keep around per endpoint.
55-
// ///
56-
// /// See [`RemoteState::prune_direct_addresses`].
57-
// pub(super) const MAX_INACTIVE_DIRECT_ADDRESSES: usize = 20;
58-
59-
// TODO: use this
60-
// /// How long since an endpoint path was last alive before it might be pruned.
61-
// const LAST_ALIVE_PRUNE_DURATION: Duration = Duration::from_secs(120);
62-
6353
// TODO: use this
6454
// /// The latency at or under which we don't try to upgrade to a better path.
6555
// const GOOD_ENOUGH_LATENCY: Duration = Duration::from_millis(5);
@@ -461,7 +451,7 @@ impl RemoteStateActor {
461451
path.set_status(status).ok();
462452
conn_state.add_open_path(path_remote.clone(), PathId::ZERO);
463453
self.paths
464-
.insert(path_remote, Source::Connection { _0: Private });
454+
.insert_open_path(path_remote.clone(), Source::Connection { _0: Private });
465455
self.select_path();
466456

467457
if path_remote_is_ip {
@@ -779,15 +769,17 @@ impl RemoteStateActor {
779769
);
780770
conn_state.add_open_path(path_remote.clone(), path_id);
781771
self.paths
782-
.insert(path_remote, Source::Connection { _0: Private });
772+
.insert_open_path(path_remote.clone(), Source::Connection { _0: Private });
783773
}
784774

785775
self.select_path();
786776
}
787777
PathEvent::Abandoned { id, path_stats } => {
788778
trace!(?path_stats, "path abandoned");
789779
// This is the last event for this path.
790-
conn_state.remove_path(&id);
780+
if let Some(addr) = conn_state.remove_path(&id) {
781+
self.paths.abandoned_path(&addr);
782+
}
791783
}
792784
PathEvent::Closed { id, .. } | PathEvent::LocallyClosed { id, .. } => {
793785
let Some(path_remote) = conn_state.paths.get(&id).cloned() else {
@@ -1073,11 +1065,13 @@ impl ConnectionState {
10731065
}
10741066

10751067
/// Completely removes a path from this connection.
1076-
fn remove_path(&mut self, path_id: &PathId) {
1077-
if let Some(addr) = self.paths.remove(path_id) {
1078-
self.path_ids.remove(&addr);
1068+
fn remove_path(&mut self, path_id: &PathId) -> Option<transports::Addr> {
1069+
let addr = self.paths.remove(path_id);
1070+
if let Some(ref addr) = addr {
1071+
self.path_ids.remove(addr);
10791072
}
10801073
self.open_paths.remove(path_id);
1074+
addr
10811075
}
10821076

10831077
/// Removes the path from the open paths.

0 commit comments

Comments
 (0)