diff --git a/Cargo.lock b/Cargo.lock index 472fd7ddd02..5396c500d46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2298,10 +2298,10 @@ dependencies = [ "iroh-relay", "n0-future", "n0-snafu", - "n0-watcher", + "n0-watcher 0.3.0", "nested_enum_utils", "netdev", - "netwatch", + "netwatch 0.8.0", "parse-size", "pin-project", "pkarr", @@ -2372,7 +2372,6 @@ dependencies = [ "iroh-quinn", "n0-future", "n0-snafu", - "n0-watcher", "rand 0.8.5", "rcgen 0.14.2", "rustls", @@ -2898,6 +2897,17 @@ dependencies = [ "snafu", ] +[[package]] +name = "n0-watcher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31462392a10d5ada4b945e840cbec2d5f3fee752b96c4b33eb41414d8f45c2a" +dependencies = [ + "derive_more 1.0.0", + "n0-future", + "snafu", +] + [[package]] name = "nested_enum_utils" version = "0.2.2" @@ -3021,7 +3031,42 @@ dependencies = [ "js-sys", "libc", "n0-future", - "n0-watcher", + "n0-watcher 0.2.0", + "nested_enum_utils", + "netdev", + "netlink-packet-core", + "netlink-packet-route 0.24.0", + "netlink-proto", + "netlink-sys", + "pin-project-lite", + "serde", + "snafu", + "socket2 0.6.0", + "time", + "tokio", + "tokio-util", + "tracing", + "web-sys", + "windows", + "windows-result", + "wmi", +] + +[[package]] +name = "netwatch" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8901dbb408894af3df3fc51420ba0c6faf3a7d896077b797c39b7001e2f787bd" +dependencies = [ + "atomic-waker", + "bytes", + "cfg_aliases", + "derive_more 2.0.1", + "iroh-quinn-udp", + "js-sys", + "libc", + "n0-future", + "n0-watcher 0.3.0", "nested_enum_utils", "netdev", "netlink-packet-core", @@ -3521,7 +3566,7 @@ dependencies = [ "iroh-metrics", "libc", "nested_enum_utils", - "netwatch", + "netwatch 0.7.0", "num_enum", "rand 0.9.1", "serde", diff --git a/iroh/Cargo.toml b/iroh/Cargo.toml index 90a3f141acf..fb816d11592 100644 --- a/iroh/Cargo.toml +++ b/iroh/Cargo.toml @@ -41,9 +41,9 @@ iroh-base = { version = "0.90.0", default-features = false, features = ["key", " iroh-relay = { version = "0.90", path = "../iroh-relay", default-features = false } n0-future = "0.1.2" n0-snafu = "0.2.1" -n0-watcher = "0.2" +n0-watcher = "0.3" nested_enum_utils = "0.2.1" -netwatch = { version = "0.7" } +netwatch = { version = "0.8" } pin-project = "1" pkarr = { version = "3.7", default-features = false, features = [ "relays", diff --git a/iroh/bench/Cargo.toml b/iroh/bench/Cargo.toml index 443bf3bf375..efa594c15e0 100644 --- a/iroh/bench/Cargo.toml +++ b/iroh/bench/Cargo.toml @@ -12,7 +12,6 @@ iroh = { path = ".." } iroh-metrics = "0.35" n0-future = "0.1.1" n0-snafu = "0.2.0" -n0-watcher = "0.2" quinn = { package = "iroh-quinn", version = "0.14" } rand = "0.8" rcgen = "0.14" diff --git a/iroh/bench/src/iroh.rs b/iroh/bench/src/iroh.rs index 004bf798e49..6393fb707ac 100644 --- a/iroh/bench/src/iroh.rs +++ b/iroh/bench/src/iroh.rs @@ -5,11 +5,10 @@ use std::{ use bytes::Bytes; use iroh::{ - Endpoint, NodeAddr, RelayMode, RelayUrl, + Endpoint, NodeAddr, RelayMode, RelayUrl, Watcher as _, endpoint::{Connection, ConnectionError, RecvStream, SendStream, TransportConfig}, }; use n0_snafu::{Result, ResultExt}; -use n0_watcher::Watcher as _; use tracing::{trace, warn}; use crate::{ @@ -50,7 +49,7 @@ pub fn server_endpoint( .unwrap(); if relay_url.is_some() { - ep.home_relay().initialized().await.unwrap(); + ep.home_relay().initialized().await; } let addr = ep.bound_sockets(); @@ -111,7 +110,7 @@ pub async fn connect_client( .unwrap(); if relay_url.is_some() { - endpoint.home_relay().initialized().await?; + endpoint.home_relay().initialized().await; } // TODO: We don't support passing client transport config currently diff --git a/iroh/examples/connect-unreliable.rs b/iroh/examples/connect-unreliable.rs index 8ba2b7b3e37..13df20bd3b1 100644 --- a/iroh/examples/connect-unreliable.rs +++ b/iroh/examples/connect-unreliable.rs @@ -52,7 +52,7 @@ async fn main() -> n0_snafu::Result<()> { .bind() .await?; - let node_addr = endpoint.node_addr().initialized().await?; + let node_addr = endpoint.node_addr().initialized().await; let me = node_addr.node_id; println!("node id: {me}"); println!("node listening addresses:"); diff --git a/iroh/examples/connect.rs b/iroh/examples/connect.rs index 2655afbdcae..df53575c819 100644 --- a/iroh/examples/connect.rs +++ b/iroh/examples/connect.rs @@ -55,19 +55,13 @@ async fn main() -> Result<()> { let me = endpoint.node_id(); println!("node id: {me}"); println!("node listening addresses:"); - for local_endpoint in endpoint - .direct_addresses() - .initialized() - .await - .context("no direct addresses")? - { + for local_endpoint in endpoint.direct_addresses().initialized().await { println!("\t{}", local_endpoint.addr) } let relay_url = endpoint .home_relay() .get() - .unwrap() .first() .cloned() .expect("should be connected to a relay server, try calling `endpoint.local_endpoints()` or `endpoint.connect()` first, to ensure the endpoint has actually attempted a connection before checking for the connected relay server"); diff --git a/iroh/examples/echo-no-router.rs b/iroh/examples/echo-no-router.rs index 4026e32a7c7..fd3b20bedf2 100644 --- a/iroh/examples/echo-no-router.rs +++ b/iroh/examples/echo-no-router.rs @@ -20,7 +20,7 @@ const ALPN: &[u8] = b"iroh-example/echo/0"; #[tokio::main] async fn main() -> Result<()> { let endpoint = start_accept_side().await?; - let node_addr = endpoint.node_addr().initialized().await?; + let node_addr = endpoint.node_addr().initialized().await; connect_side(node_addr).await?; diff --git a/iroh/examples/echo.rs b/iroh/examples/echo.rs index 9e690b3caad..645647dac90 100644 --- a/iroh/examples/echo.rs +++ b/iroh/examples/echo.rs @@ -23,7 +23,7 @@ const ALPN: &[u8] = b"iroh-example/echo/0"; #[tokio::main] async fn main() -> Result<()> { let router = start_accept_side().await?; - let node_addr = router.endpoint().node_addr().initialized().await?; + let node_addr = router.endpoint().node_addr().initialized().await; connect_side(node_addr).await?; diff --git a/iroh/examples/listen-unreliable.rs b/iroh/examples/listen-unreliable.rs index 593e6a8b93b..a89f6d58427 100644 --- a/iroh/examples/listen-unreliable.rs +++ b/iroh/examples/listen-unreliable.rs @@ -37,7 +37,7 @@ async fn main() -> Result<()> { println!("node id: {me}"); println!("node listening addresses:"); - let node_addr = endpoint.node_addr().initialized().await?; + let node_addr = endpoint.node_addr().initialized().await; let local_addrs = node_addr .direct_addresses .into_iter() diff --git a/iroh/examples/listen.rs b/iroh/examples/listen.rs index 00e79cbe31c..f4fdca243b2 100644 --- a/iroh/examples/listen.rs +++ b/iroh/examples/listen.rs @@ -42,7 +42,7 @@ async fn main() -> n0_snafu::Result<()> { let local_addrs = endpoint .direct_addresses() .initialized() - .await? + .await .into_iter() .map(|addr| { let addr = addr.addr.to_string(); @@ -51,7 +51,7 @@ async fn main() -> n0_snafu::Result<()> { }) .collect::>() .join(" "); - let relay_url = endpoint.home_relay().initialized().await?; + let relay_url = endpoint.home_relay().initialized().await; println!("node relay server url: {relay_url}"); println!("\nin a separate terminal run:"); diff --git a/iroh/examples/transfer.rs b/iroh/examples/transfer.rs index 39b05f49ff3..47657fdf9e4 100644 --- a/iroh/examples/transfer.rs +++ b/iroh/examples/transfer.rs @@ -244,22 +244,18 @@ impl EndpointArgs { let node_id = endpoint.node_id(); println!("Our node id:\n\t{node_id}"); - let eps = endpoint.direct_addresses().initialized().await?; + let eps = endpoint.direct_addresses().initialized().await; println!("Our direct addresses:"); for local_endpoint in eps { println!("\t{} (type: {:?})", local_endpoint.addr, local_endpoint.typ) } if self.relay_only { - let relay_url = endpoint.home_relay().initialized().await?; + let relay_url = endpoint.home_relay().initialized().await; println!("Our home relay server:\t{relay_url}"); } else if !self.no_relay { let relay_url = tokio::time::timeout(Duration::from_secs(2), async { - endpoint - .home_relay() - .initialized() - .await - .expect("disconnected") + endpoint.home_relay().initialized().await }) .await .ok(); @@ -278,11 +274,11 @@ impl EndpointArgs { async fn provide(endpoint: Endpoint, size: u64) -> Result<()> { let node_id = endpoint.node_id(); - let node_addr = endpoint.node_addr().initialized().await?; + let node_addr = endpoint.node_addr().initialized().await; let ticket = NodeTicket::new(node_addr); println!("Ticket with our home relay and direct addresses:\n{ticket}\n",); - let mut node_addr = endpoint.node_addr().initialized().await?; + let mut node_addr = endpoint.node_addr().initialized().await; node_addr.direct_addresses = Default::default(); let ticket = NodeTicket::new(node_addr); println!("Ticket with our home relay but no direct addresses:\n{ticket}\n",); diff --git a/iroh/src/discovery.rs b/iroh/src/discovery.rs index 8da9a4e78a6..a1907c2728b 100644 --- a/iroh/src/discovery.rs +++ b/iroh/src/discovery.rs @@ -872,7 +872,7 @@ mod tests { }; let ep1_addr = NodeAddr::new(ep1.node_id()); // wait for our address to be updated and thus published at least once - ep1.node_addr().initialized().await?; + ep1.node_addr().initialized().await; let _conn = ep2.connect(ep1_addr, TEST_ALPN).await?; Ok(()) } @@ -898,10 +898,7 @@ mod tests { }; let ep1_addr = NodeAddr::new(ep1.node_id()); // wait for out address to be updated and thus published at least once - ep1.node_addr() - .initialized() - .await - .context("waiting for NodeAddr")?; + ep1.node_addr().initialized().await; let _conn = ep2 .connect(ep1_addr, TEST_ALPN) .await @@ -933,7 +930,7 @@ mod tests { new_endpoint(secret, disco).await }; // wait for out address to be updated and thus published at least once - ep1.node_addr().initialized().await?; + ep1.node_addr().initialized().await; let _conn = ep2.connect(ep1.node_id(), TEST_ALPN).await?; Ok(()) } @@ -955,7 +952,7 @@ mod tests { new_endpoint(secret, disco).await }; // wait for out address to be updated and thus published at least once - ep1.node_addr().initialized().await?; + ep1.node_addr().initialized().await; // 10x faster test via a 3s idle timeout instead of the 30s default let mut config = TransportConfig::default(); @@ -988,7 +985,7 @@ mod tests { new_endpoint(secret, disco).await }; // wait for out address to be updated and thus published at least once - ep1.node_addr().initialized().await?; + ep1.node_addr().initialized().await; let ep1_wrong_addr = NodeAddr { node_id: ep1.node_id(), relay_url: None, @@ -1016,7 +1013,7 @@ mod tests { let mut stream = ep1.discovery_stream(); // wait for ep2 node addr to be updated and connect from ep1 -> discovery via resolve - ep2.node_addr().initialized().await?; + ep2.node_addr().initialized().await; let _ = ep1.connect(ep2.node_id(), TEST_ALPN).await?; let item = tokio::time::timeout(Duration::from_secs(1), stream.next()) diff --git a/iroh/src/discovery/pkarr.rs b/iroh/src/discovery/pkarr.rs index 893b7cbd1a0..29d2ccd275f 100644 --- a/iroh/src/discovery/pkarr.rs +++ b/iroh/src/discovery/pkarr.rs @@ -349,10 +349,10 @@ impl PublisherService { let republish = time::sleep(Duration::MAX); tokio::pin!(republish); loop { - let Ok(info) = self.watcher.get() else { - break; // disconnected - }; - if let Some(info) = info { + if !self.watcher.is_connected() { + break; + } + if let Some(info) = self.watcher.get() { match self.publish_current(info).await { Err(err) => { failed_attempts += 1; diff --git a/iroh/src/endpoint.rs b/iroh/src/endpoint.rs index f78115fdeab..c0a087b1902 100644 --- a/iroh/src/endpoint.rs +++ b/iroh/src/endpoint.rs @@ -905,7 +905,7 @@ impl Endpoint { /// .alpns(vec![b"my-alpn".to_vec()]) /// .bind() /// .await?; - /// let node_addr = endpoint.node_addr().initialized().await?; + /// let node_addr = endpoint.node_addr().initialized().await; /// # let _ = node_addr; /// # Ok(()) /// # } @@ -973,7 +973,7 @@ impl Endpoint { /// # let rt = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap(); /// # rt.block_on(async move { /// let mep = Endpoint::builder().bind().await.unwrap(); - /// let _relay_url = mep.home_relay().initialized().await.unwrap(); + /// let _relay_url = mep.home_relay().initialized().await; /// # }); /// ``` pub fn home_relay(&self) -> impl n0_watcher::Watcher> + use<> { @@ -1008,7 +1008,7 @@ impl Endpoint { /// # let rt = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap(); /// # rt.block_on(async move { /// let ep = Endpoint::builder().bind().await.unwrap(); - /// let _addrs = ep.direct_addresses().initialized().await.unwrap(); + /// let _addrs = ep.direct_addresses().initialized().await; /// # }); /// ``` /// @@ -1042,7 +1042,7 @@ impl Endpoint { /// # let rt = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap(); /// # rt.block_on(async move { /// let ep = Endpoint::builder().bind().await.unwrap(); - /// let _report = ep.net_report().initialized().await.unwrap(); + /// let _report = ep.net_report().initialized().await; /// # }); /// ``` #[doc(hidden)] @@ -2278,7 +2278,7 @@ mod tests { .bind() .await .unwrap(); - let my_addr = ep.node_addr().initialized().await.unwrap(); + let my_addr = ep.node_addr().initialized().await; let res = ep.connect(my_addr.clone(), TEST_ALPN).await; assert!(res.is_err()); let err = res.err().unwrap(); @@ -2307,7 +2307,7 @@ mod tests { .bind() .await?; // Wait for the endpoint to be reachable via relay - ep.home_relay().initialized().await?; + ep.home_relay().initialized().await; let server = tokio::spawn( async move { @@ -2461,7 +2461,7 @@ mod tests { .bind() .await?; // Also make sure the server has a working relay connection - ep.home_relay().initialized().await?; + ep.home_relay().initialized().await; info!(time = ?test_start.elapsed(), "test setup done"); @@ -2581,7 +2581,7 @@ mod tests { } }); - let addr = server.node_addr().initialized().await?; + let addr = server.node_addr().initialized().await; let conn = client.connect(addr, TEST_ALPN).await?; let (mut send, mut recv) = conn.open_bi().await.e()?; send.write_all(b"Hello, world!").await.e()?; @@ -2613,8 +2613,8 @@ mod tests { let ep2 = ep2.bind().await?; - let ep1_nodeaddr = ep1.node_addr().initialized().await?; - let ep2_nodeaddr = ep2.node_addr().initialized().await?; + let ep1_nodeaddr = ep1.node_addr().initialized().await; + let ep2_nodeaddr = ep2.node_addr().initialized().await; ep1.add_node_addr(ep2_nodeaddr.clone())?; ep2.add_node_addr(ep1_nodeaddr.clone())?; let ep1_nodeid = ep1.node_id(); @@ -2739,7 +2739,7 @@ mod tests { let ep1_nodeid = ep1.node_id(); let ep2_nodeid = ep2.node_id(); - let ep1_nodeaddr = ep1.node_addr().initialized().await?; + let ep1_nodeaddr = ep1.node_addr().initialized().await; tracing::info!( "node id 1 {ep1_nodeid}, relay URL {:?}", ep1_nodeaddr.relay_url() @@ -2791,7 +2791,7 @@ mod tests { tokio::time::timeout(Duration::from_secs(10), ep.direct_addresses().initialized()) .await - .e()??; + .e()?; Ok(()) } @@ -2901,9 +2901,9 @@ mod tests { ) .await?; - connect_client_0rtt_expect_err(&client, server.node_addr().initialized().await?).await?; + connect_client_0rtt_expect_err(&client, server.node_addr().initialized().await).await?; // The second 0rtt attempt should work - connect_client_0rtt_expect_ok(&client, server.node_addr().initialized().await?, true) + connect_client_0rtt_expect_ok(&client, server.node_addr().initialized().await, true) .await?; client.close().await; @@ -2928,7 +2928,7 @@ mod tests { ) .await?; - connect_client_0rtt_expect_err(&client, server.node_addr().initialized().await?).await?; + connect_client_0rtt_expect_err(&client, server.node_addr().initialized().await).await?; // connecting with another endpoint should not interfere with our // TLS session ticket cache for the first endpoint: @@ -2937,10 +2937,10 @@ mod tests { info_span!("another"), ) .await?; - connect_client_0rtt_expect_err(&client, another.node_addr().initialized().await?).await?; + connect_client_0rtt_expect_err(&client, another.node_addr().initialized().await).await?; another.close().await; - connect_client_0rtt_expect_ok(&client, server.node_addr().initialized().await?, true) + connect_client_0rtt_expect_ok(&client, server.node_addr().initialized().await, true) .await?; client.close().await; @@ -2960,8 +2960,8 @@ mod tests { let server_key = SecretKey::generate(rand::thread_rng()); let server = spawn_0rtt_server(server_key.clone(), info_span!("server-initial")).await?; - connect_client_0rtt_expect_err(&client, server.node_addr().initialized().await?).await?; - connect_client_0rtt_expect_ok(&client, server.node_addr().initialized().await?, true) + connect_client_0rtt_expect_err(&client, server.node_addr().initialized().await).await?; + connect_client_0rtt_expect_ok(&client, server.node_addr().initialized().await, true) .await?; server.close().await; @@ -2971,7 +2971,7 @@ mod tests { // we expect the client to *believe* it can 0-RTT connect to the server (hence expect_ok), // but the server will reject the early data because it discarded necessary state // to decrypt it when restarting. - connect_client_0rtt_expect_ok(&client, server.node_addr().initialized().await?, false) + connect_client_0rtt_expect_ok(&client, server.node_addr().initialized().await, false) .await?; client.close().await; @@ -2988,7 +2988,7 @@ mod tests { .alpns(vec![TEST_ALPN.to_vec()]) .bind() .await?; - let server_addr = server.node_addr().initialized().await?; + let server_addr = server.node_addr().initialized().await; let server_task = tokio::spawn(async move { let incoming = server.accept().await.e()?; let conn = incoming.await.e()?; @@ -3038,7 +3038,7 @@ mod tests { .alpns(vec![TEST_ALPN.to_vec()]) .bind() .await?; - let server_addr = server.node_addr().initialized().await?; + let server_addr = server.node_addr().initialized().await; let server_task = tokio::task::spawn(async move { let conn = server.accept().await.e()?.accept().e()?.await.e()?; let mut uni = conn.accept_uni().await.e()?; @@ -3099,7 +3099,7 @@ mod tests { .alpns(accept_alpns) .bind() .await?; - let server_addr = server.node_addr().initialized().await?; + let server_addr = server.node_addr().initialized().await; let server_task = tokio::spawn({ let server = server.clone(); async move { diff --git a/iroh/src/magicsock.rs b/iroh/src/magicsock.rs index 2bf4ed47170..56bc55239da 100644 --- a/iroh/src/magicsock.rs +++ b/iroh/src/magicsock.rs @@ -268,7 +268,7 @@ impl MagicSock { /// Get the cached version of addresses. pub(crate) fn local_addr(&self) -> Vec { - self.local_addrs_watch.get().expect("disconnected") + self.local_addrs_watch.clone().get() } #[cfg(not(wasm_browser))] @@ -460,7 +460,7 @@ impl MagicSock { #[cfg_attr(windows, allow(dead_code))] fn normalized_local_addr(&self) -> io::Result { - let addrs = self.local_addrs_watch.get().expect("disconnected"); + let addrs = self.local_addrs_watch.clone().get(); let mut ipv4_addr = None; for addr in addrs { @@ -1730,7 +1730,7 @@ impl Actor { self.update_direct_addresses(None); // Setup network monitoring - let mut current_netmon_state = self.netmon_watcher.get().expect("missing network state"); + let mut current_netmon_state = self.netmon_watcher.get(); #[cfg(not(wasm_browser))] let mut direct_addr_heartbeat_timer = time::interval(HEARTBEAT_INTERVAL); @@ -1820,7 +1820,7 @@ impl Actor { match reason { Some(()) => { // check if a new run needs to be scheduled - let state = self.netmon_watcher.get().expect("disconnected"); + let state = self.netmon_watcher.get(); self.direct_addr_update_state.try_run(state.into()); } None => { @@ -1920,7 +1920,7 @@ impl Actor { } fn re_stun(&mut self, why: UpdateReason) { - let state = self.netmon_watcher.get().expect("disconnected"); + let state = self.netmon_watcher.get(); self.direct_addr_update_state .schedule_run(why, state.into()); } @@ -1947,7 +1947,7 @@ impl Actor { if let Some((node, url)) = data { self.pending_call_me_maybes.insert(node, url); } - let state = self.netmon_watcher.get().expect("disconnected"); + let state = self.netmon_watcher.get(); self.direct_addr_update_state .schedule_run(why, state.into()); } @@ -2056,11 +2056,7 @@ impl Actor { let LocalAddresses { regular: mut ips, loopback, - } = self - .netmon_watcher - .get() - .expect("netmon disconnected") - .local_addresses; + } = self.netmon_watcher.get().local_addresses; if ips.is_empty() && addrs.is_empty() { // Include loopback addresses only if there are no other interfaces // or public addresses, this allows testing offline. @@ -2799,7 +2795,7 @@ mod tests { println!("first conn!"); let conn = m1 .endpoint - .connect(m2.endpoint.node_addr().initialized().await?, ALPN) + .connect(m2.endpoint.node_addr().initialized().await, ALPN) .await?; println!("Closing first conn"); conn.close(0u32.into(), b"bye lolz"); @@ -2947,12 +2943,12 @@ mod tests { let ms = Handle::new(Default::default()).await.unwrap(); // See if we can get endpoints. - let eps0 = ms.direct_addresses().initialized().await.unwrap(); + let eps0 = ms.direct_addresses().initialized().await; println!("{eps0:?}"); assert!(!eps0.is_empty()); // Getting the endpoints again immediately should give the same results. - let eps1 = ms.direct_addresses().initialized().await.unwrap(); + let eps1 = ms.direct_addresses().initialized().await; println!("{eps1:?}"); assert_eq!(eps0, eps1); } @@ -3111,7 +3107,6 @@ mod tests { .direct_addresses() .initialized() .await - .expect("no direct addrs") .into_iter() .map(|x| x.addr) .collect(), @@ -3222,7 +3217,6 @@ mod tests { .direct_addresses() .initialized() .await - .expect("no direct addrs") .into_iter() .map(|x| x.addr) .collect(), diff --git a/iroh/src/magicsock/transports.rs b/iroh/src/magicsock/transports.rs index 3e6827f7a31..46cfb210898 100644 --- a/iroh/src/magicsock/transports.rs +++ b/iroh/src/magicsock/transports.rs @@ -145,7 +145,7 @@ impl Transports { /// For IP based transports this is the [`SocketAddr`] of the socket, /// for relay transports, this is the home relay. pub(crate) fn local_addrs(&self) -> Vec { - self.local_addrs_watch().get().expect("not disconnected") + self.local_addrs_watch().get() } /// Watch for all currently known local addresses. diff --git a/iroh/src/protocol.rs b/iroh/src/protocol.rs index e1f664b4252..89117732312 100644 --- a/iroh/src/protocol.rs +++ b/iroh/src/protocol.rs @@ -629,7 +629,7 @@ mod tests { let proto = AccessLimit::new(Echo, |_node_id| false); let r1 = Router::builder(e1.clone()).accept(ECHO_ALPN, proto).spawn(); - let addr1 = r1.endpoint().node_addr().initialized().await?; + let addr1 = r1.endpoint().node_addr().initialized().await; dbg!(&addr1); let e2 = Endpoint::builder() .relay_mode(RelayMode::Disabled) @@ -682,7 +682,7 @@ mod tests { .accept(TEST_ALPN, TestProtocol::default()) .spawn(); eprintln!("waiting for node addr"); - let addr = router.endpoint().node_addr().initialized().await?; + let addr = router.endpoint().node_addr().initialized().await; eprintln!("creating ep2"); let endpoint2 = Endpoint::builder()