Skip to content

Commit 2b4da13

Browse files
authored
Depend on n0-watcher version 0.6.0 (#3652)
## Description Bumps the `n0-watcher` dependency to the released version. Depends on `net-tools` also bumping the n0-watcher version: - [x] n0-computer/net-tools#64 ## Change checklist <!-- Remove any that are not relevant. --> - [x] Self-review.
1 parent 877cdcf commit 2b4da13

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ unused-async = "warn"
4343

4444

4545
[patch.crates-io]
46-
n0-watcher = { git = "https://github.com/n0-computer/n0-watcher", branch = "feat-get-ref" }
47-
4846
iroh-quinn = { git = "https://github.com/n0-computer/quinn", branch = "main-iroh" }
4947
iroh-quinn-proto = { git = "https://github.com/n0-computer/quinn", branch = "main-iroh" }
5048
iroh-quinn-udp = { git = "https://github.com/n0-computer/quinn", branch = "main-iroh" }

iroh/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ iroh-base = { version = "0.95.1", default-features = false, features = ["key", "
3333
iroh-relay = { version = "0.95", path = "../iroh-relay", default-features = false }
3434
n0-future = "0.3.0"
3535
n0-error = "0.1.0"
36-
n0-watcher = "0.5"
36+
n0-watcher = "0.6"
3737
netwatch = { version = "0.12" }
3838
pin-project = "1"
3939
pkarr = { version = "5", default-features = false, features = ["relays"] }

iroh/src/magicsock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ impl MagicSock {
491491

492492
#[cfg_attr(windows, allow(dead_code))]
493493
fn normalized_local_addr(&self) -> io::Result<SocketAddr> {
494-
let addrs = self.local_addrs_watch.get_ref();
494+
let addrs = self.local_addrs_watch.peek();
495495

496496
let mut ipv4_addr = None;
497497
for addr in addrs {

iroh/src/magicsock/endpoint_map/endpoint_state.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,20 +1146,21 @@ impl PathsWatchable {
11461146
&self,
11471147
conn_handle: WeakConnectionHandle,
11481148
) -> impl Watcher<Value = PathInfoList> + Unpin + Send + Sync + 'static {
1149-
let joined_watcher = (self.open_paths.watch(), self.selected_path.watch());
1150-
joined_watcher.map(move |(open_paths, selected_path)| {
1151-
let selected_path: Option<TransportAddr> = selected_path.map(Into::into);
1152-
let Some(conn) = conn_handle.upgrade() else {
1153-
return PathInfoList(Default::default());
1154-
};
1155-
let list = open_paths
1156-
.into_iter()
1157-
.flat_map(move |(remote, path_id)| {
1158-
PathInfo::new(path_id, &conn, remote, selected_path.as_ref())
1159-
})
1160-
.collect();
1161-
PathInfoList(list)
1162-
})
1149+
self.open_paths.watch().or(self.selected_path.watch()).map(
1150+
move |(open_paths, selected_path)| {
1151+
let selected_path: Option<TransportAddr> = selected_path.map(Into::into);
1152+
let Some(conn) = conn_handle.upgrade() else {
1153+
return PathInfoList(Default::default());
1154+
};
1155+
let list = open_paths
1156+
.into_iter()
1157+
.flat_map(move |(remote, path_id)| {
1158+
PathInfo::new(path_id, &conn, remote, selected_path.as_ref())
1159+
})
1160+
.collect();
1161+
PathInfoList(list)
1162+
},
1163+
)
11631164
}
11641165
}
11651166

iroh/src/magicsock/transports.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ pub(crate) struct Transports {
4040

4141
#[cfg(not(wasm_browser))]
4242
pub(crate) type LocalAddrsWatch = n0_watcher::Map<
43-
(
43+
n0_watcher::Tuple<
4444
n0_watcher::Join<SocketAddr, n0_watcher::Direct<SocketAddr>>,
4545
n0_watcher::Join<
4646
Option<(RelayUrl, EndpointId)>,
4747
n0_watcher::Map<n0_watcher::Direct<Option<RelayUrl>>, Option<(RelayUrl, EndpointId)>>,
4848
>,
49-
),
49+
>,
5050
Vec<Addr>,
5151
>;
5252

@@ -155,7 +155,7 @@ impl Transports {
155155
let ips = n0_watcher::Join::new(self.ip.iter().map(|t| t.local_addr_watch()));
156156
let relays = n0_watcher::Join::new(self.relay.iter().map(|t| t.local_addr_watch()));
157157

158-
(ips, relays).map(|(ips, relays)| {
158+
ips.or(relays).map(|(ips, relays)| {
159159
ips.into_iter()
160160
.map(Addr::from)
161161
.chain(

0 commit comments

Comments
 (0)