Skip to content

Commit 722ae84

Browse files
matheus23dignifiedquire
authored andcommitted
Depend on n0-watcher version 0.6.0 (#3652)
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 <!-- Remove any that are not relevant. --> - [x] Self-review.
1 parent 697b65b commit 722ae84

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
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: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,10 +1183,10 @@ impl ConnectionState {
11831183
pub(crate) struct PathsWatcher(
11841184
Box<
11851185
n0_watcher::Map<
1186-
(
1186+
n0_watcher::Tuple<
11871187
n0_watcher::Direct<PathAddrList>,
11881188
n0_watcher::Direct<Option<transports::Addr>>,
1189-
),
1189+
>,
11901190
PathInfoList,
11911191
>,
11921192
>,
@@ -1195,8 +1195,12 @@ pub(crate) struct PathsWatcher(
11951195
impl n0_watcher::Watcher for PathsWatcher {
11961196
type Value = PathInfoList;
11971197

1198-
fn get(&mut self) -> Self::Value {
1199-
self.0.get()
1198+
fn update(&mut self) -> bool {
1199+
self.0.update()
1200+
}
1201+
1202+
fn peek(&self) -> &Self::Value {
1203+
self.0.peek()
12001204
}
12011205

12021206
fn is_connected(&self) -> bool {
@@ -1206,7 +1210,7 @@ impl n0_watcher::Watcher for PathsWatcher {
12061210
fn poll_updated(
12071211
&mut self,
12081212
cx: &mut std::task::Context<'_>,
1209-
) -> Poll<Result<Self::Value, n0_watcher::Disconnected>> {
1213+
) -> Poll<Result<(), n0_watcher::Disconnected>> {
12101214
self.0.poll_updated(cx)
12111215
}
12121216
}

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)