Skip to content

Commit 4846af0

Browse files
committed
docs
1 parent 5f51c54 commit 4846af0

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

iroh/src/magicsock/endpoint_map/endpoint_state.rs

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,10 @@ impl ConnectionState {
11481148
///
11491149
/// This is stored in the [`Connection`], and the watchables are set from within the endpoint state actor.
11501150
///
1151+
/// Internally, this contains a boxed-mapped-joined watcher over the open paths in the connection and the
1152+
/// selected path to the remote endpoint. The watcher is boxed because the mapped-joined watcher with
1153+
/// `SmallVec<PathInfoList>` has a size of over 800 bytes, which we don't want to put upon the [`Connection`].
1154+
///
11511155
/// [`Connection`]: crate::endpoint::Connection
11521156
#[derive(Clone, derive_more::Debug)]
11531157
#[debug("PathsWatcher")]
@@ -1188,21 +1192,24 @@ impl PathsWatcher {
11881192
selected_path: n0_watcher::Direct<Option<transports::Addr>>,
11891193
conn_handle: WeakConnectionHandle,
11901194
) -> Self {
1191-
Self(Box::new(open_paths.or(selected_path).map(
1192-
move |(open_paths, selected_path)| {
1193-
let selected_path: Option<TransportAddr> = selected_path.map(Into::into);
1194-
let Some(conn) = conn_handle.upgrade() else {
1195-
return PathInfoList(Default::default());
1196-
};
1197-
let list = open_paths
1198-
.into_iter()
1199-
.flat_map(move |(remote, path_id)| {
1200-
PathInfo::new(path_id, &conn, remote, selected_path.as_ref())
1201-
})
1202-
.collect();
1203-
PathInfoList(list)
1204-
},
1205-
)))
1195+
Self(Box::new({
1196+
let inner = open_paths
1197+
.or(selected_path)
1198+
.map(move |(open_paths, selected_path)| {
1199+
let selected_path: Option<TransportAddr> = selected_path.map(Into::into);
1200+
let Some(conn) = conn_handle.upgrade() else {
1201+
return PathInfoList(Default::default());
1202+
};
1203+
let list = open_paths
1204+
.into_iter()
1205+
.flat_map(move |(remote, path_id)| {
1206+
PathInfo::new(path_id, &conn, remote, selected_path.as_ref())
1207+
})
1208+
.collect();
1209+
PathInfoList(list)
1210+
});
1211+
inner
1212+
}))
12061213
}
12071214
}
12081215

0 commit comments

Comments
 (0)