Enum iroh_net_bench::EndpointSelector
source · pub enum EndpointSelector {
- Iroh(Endpoint),
+ Iroh(Endpoint),
Quinn(Endpoint),
-}Variants§
Implementations§
Auto Trait Implementations§
impl Freeze for EndpointSelector
impl !RefUnwindSafe for EndpointSelector
impl Send for EndpointSelector
impl Sync for EndpointSelector
impl Unpin for EndpointSelector
impl !UnwindSafe for EndpointSelector
Blanket Implementations§
source§impl<T> Any for Twhere
+}Variants§
Implementations§
Auto Trait Implementations§
§impl Freeze for EndpointSelector
§impl !RefUnwindSafe for EndpointSelector
§impl Send for EndpointSelector
§impl Sync for EndpointSelector
§impl Unpin for EndpointSelector
§impl !UnwindSafe for EndpointSelector
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§fn implicit(
diff --git a/pr/2878/docs/iroh_net_bench/iroh/fn.connect_client.html b/pr/2878/docs/iroh_net_bench/iroh/fn.connect_client.html
index e440e4b78b..fa168191b6 100644
--- a/pr/2878/docs/iroh_net_bench/iroh/fn.connect_client.html
+++ b/pr/2878/docs/iroh_net_bench/iroh/fn.connect_client.html
@@ -2,5 +2,5 @@
server_addr: NodeAddr,
relay_url: Option<RelayUrl>,
opt: Opt
-) -> Result<(Endpoint, Connection)>Expand description
Create a client endpoint and client connection
+) -> Result<(Endpoint, Connection)>Expand description
Create a client endpoint and client connection
\ No newline at end of file
diff --git a/pr/2878/docs/iroh_net_bench/iroh/fn.server.html b/pr/2878/docs/iroh_net_bench/iroh/fn.server.html
index cfacd00516..8a978024ab 100644
--- a/pr/2878/docs/iroh_net_bench/iroh/fn.server.html
+++ b/pr/2878/docs/iroh_net_bench/iroh/fn.server.html
@@ -1,2 +1,2 @@
-server in iroh_net_bench::iroh - Rust Function iroh_net_bench::iroh::server
source · pub async fn server(endpoint: Endpoint, opt: Opt) -> Result<()>
Expand description
Take the provided endpoint and run the server
+server in iroh_net_bench::iroh - Rust
\ No newline at end of file
diff --git a/pr/2878/docs/iroh_net_bench/iroh/fn.server_endpoint.html b/pr/2878/docs/iroh_net_bench/iroh/fn.server_endpoint.html
index aa3032746c..89f7367650 100644
--- a/pr/2878/docs/iroh_net_bench/iroh/fn.server_endpoint.html
+++ b/pr/2878/docs/iroh_net_bench/iroh/fn.server_endpoint.html
@@ -2,5 +2,5 @@
rt: &Runtime,
relay_url: &Option<RelayUrl>,
opt: &Opt
-) -> (NodeAddr, Endpoint)Expand description
Creates a server endpoint which runs on the given runtime
+) -> (NodeAddr, Endpoint)Expand description
Creates a server endpoint which runs on the given runtime
\ No newline at end of file
diff --git a/pr/2878/docs/portmapper/index.html b/pr/2878/docs/portmapper/index.html
index a2d94115af..1c503b84f6 100644
--- a/pr/2878/docs/portmapper/index.html
+++ b/pr/2878/docs/portmapper/index.html
@@ -1,2 +1,2 @@
-portmapper - Rust Crate portmapper
source · Expand description
Port mapping client and service.
+portmapper - Rust Crate portmapper
source · Expand description
Port mapping client and service.
Structs§
- Port mapping client.
- Configures which port mapping protocols are enabled in the
Service. - Enum of metrics for the module
- Output of a port mapping probe.
- A port mapping client.
\ No newline at end of file
diff --git a/pr/2878/docs/portmapper/struct.Service.html b/pr/2878/docs/portmapper/struct.Service.html
index ac805083f4..c90e6569cf 100644
--- a/pr/2878/docs/portmapper/struct.Service.html
+++ b/pr/2878/docs/portmapper/struct.Service.html
@@ -1,5 +1,5 @@
-Service in portmapper - Rust Struct portmapper::Service
source · pub struct Service { /* private fields */ }
Expand description
A port mapping client.
-Trait Implementations§
Auto Trait Implementations§
§impl Freeze for Service
§impl !RefUnwindSafe for Service
§impl Send for Service
§impl Sync for Service
§impl Unpin for Service
§impl !UnwindSafe for Service
Blanket Implementations§
source§impl<T> Any for Twhere
+Service in portmapper - Rust Struct portmapper::Service
source · pub struct Service { /* private fields */ }
Expand description
A port mapping client.
+Trait Implementations§
Auto Trait Implementations§
§impl Freeze for Service
§impl !RefUnwindSafe for Service
§impl Send for Service
§impl Sync for Service
§impl Unpin for Service
§impl !UnwindSafe for Service
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moresource§impl<T> From<T> for T
source§fn from(t: T) -> T
Returns the argument unchanged.
diff --git a/pr/2878/docs/src/portmapper/lib.rs.html b/pr/2878/docs/src/portmapper/lib.rs.html
index a2aadfed9b..9c18f2a6dc 100644
--- a/pr/2878/docs/src/portmapper/lib.rs.html
+++ b/pr/2878/docs/src/portmapper/lib.rs.html
@@ -713,17 +713,6 @@
713
714
715
-716
-717
-718
-719
-720
-721
-722
-723
-724
-725
-726
//! Port mapping client and service.
use std::{
@@ -978,13 +967,10 @@
inner: (enable_upnp && !upnp).then(|| {
Box::pin(async {
tracing::info!("upnp probe, sleeping");
- tokio::time::timeout(Duration::from_secs(3), async move {
- upnp::probe_available()
- .await
- .map(|addr| (addr, Instant::now()))
- })
- .await
- })
+ upnp::probe_available()
+ .await
+ .map(|addr| (addr, Instant::now()))
+ })
}),
};
@@ -1023,15 +1009,7 @@
tokio::select! {
last_upnp_gateway_addr = &mut upnp_probing_task, if !upnp_done => {
trace!("tick: upnp probe ready");
- match last_upnp_gateway_addr {
- Ok(addr) => {
- probe.last_upnp_gateway_addr = addr;
- }
- Err(_err) => {
- probe.last_upnp_gateway_addr = None;
- tracing::debug!("upnp probe timed out");
- }
- }
+ probe.last_upnp_gateway_addr = last_upnp_gateway_addr;
upnp_done = true;
},
last_nat_pmp = &mut nat_pmp_probing_task, if !nat_pmp_done => {
diff --git a/pr/2878/docs/src/portmapper/upnp.rs.html b/pr/2878/docs/src/portmapper/upnp.rs.html
index 8922ad5dc5..5346754a54 100644
--- a/pr/2878/docs/src/portmapper/upnp.rs.html
+++ b/pr/2878/docs/src/portmapper/upnp.rs.html
@@ -140,6 +140,21 @@
140
141
142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
use std::{
net::{Ipv4Addr, SocketAddrV4},
num::NonZeroU16,
@@ -191,11 +206,15 @@
let gateway = if let Some(known_gateway) = gateway {
known_gateway
} else {
- aigd::tokio::search_gateway(igd_next::SearchOptions {
- timeout: Some(SEARCH_TIMEOUT),
- ..Default::default()
- })
- .await?
+ // Wrap in manual timeout, because igd_next doesn't respect the set timeout
+ tokio::time::timeout(
+ SEARCH_TIMEOUT,
+ aigd::tokio::search_gateway(igd_next::SearchOptions {
+ timeout: Some(SEARCH_TIMEOUT),
+ ..Default::default()
+ }),
+ )
+ .await??
};
let std::net::IpAddr::V4(external_ip) = gateway.get_external_ip().await? else {
@@ -268,18 +287,28 @@
/// Searches for UPnP gateways.
pub async fn probe_available() -> Option<Gateway> {
inc!(Metrics, upnp_probes);
- match aigd::tokio::search_gateway(igd_next::SearchOptions {
- timeout: Some(SEARCH_TIMEOUT),
- ..Default::default()
- })
- .await
- {
- Ok(gateway) => Some(gateway),
+
+ // Wrap in manual timeout, because igd_next doesn't respect the set timeout
+ let res = tokio::time::timeout(
+ SEARCH_TIMEOUT,
+ aigd::tokio::search_gateway(igd_next::SearchOptions {
+ timeout: Some(SEARCH_TIMEOUT),
+ ..Default::default()
+ }),
+ )
+ .await;
+
+ match res {
+ Ok(Ok(gateway)) => Some(gateway),
Err(e) => {
+ inc!(Metrics, upnp_probes_failed);
+ debug!("upnp probe timed out: {e}");
+ None
+ }
+ Ok(Err(e)) => {
inc!(Metrics, upnp_probes_failed);
debug!("upnp probe failed: {e}");
None
}
}
-}
-
\ No newline at end of file
+}
\ No newline at end of file
impl<T> Any for Twhere
+}Variants§
Implementations§
Auto Trait Implementations§
§impl Freeze for EndpointSelector
§impl !RefUnwindSafe for EndpointSelector
§impl Send for EndpointSelector
§impl Sync for EndpointSelector
§impl Unpin for EndpointSelector
§impl !UnwindSafe for EndpointSelector
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§fn implicit(
diff --git a/pr/2878/docs/iroh_net_bench/iroh/fn.connect_client.html b/pr/2878/docs/iroh_net_bench/iroh/fn.connect_client.html
index e440e4b78b..fa168191b6 100644
--- a/pr/2878/docs/iroh_net_bench/iroh/fn.connect_client.html
+++ b/pr/2878/docs/iroh_net_bench/iroh/fn.connect_client.html
@@ -2,5 +2,5 @@
server_addr: NodeAddr,
relay_url: Option<RelayUrl>,
opt: Opt
-) -> Result<(Endpoint, Connection)>Expand description
Create a client endpoint and client connection
+) -> Result<(Endpoint, Connection)>Expand description
Create a client endpoint and client connection
\ No newline at end of file
diff --git a/pr/2878/docs/iroh_net_bench/iroh/fn.server.html b/pr/2878/docs/iroh_net_bench/iroh/fn.server.html
index cfacd00516..8a978024ab 100644
--- a/pr/2878/docs/iroh_net_bench/iroh/fn.server.html
+++ b/pr/2878/docs/iroh_net_bench/iroh/fn.server.html
@@ -1,2 +1,2 @@
-server in iroh_net_bench::iroh - Rust Function iroh_net_bench::iroh::server
source · pub async fn server(endpoint: Endpoint, opt: Opt) -> Result<()>
Expand description
Take the provided endpoint and run the server
+server in iroh_net_bench::iroh - Rust
\ No newline at end of file
diff --git a/pr/2878/docs/iroh_net_bench/iroh/fn.server_endpoint.html b/pr/2878/docs/iroh_net_bench/iroh/fn.server_endpoint.html
index aa3032746c..89f7367650 100644
--- a/pr/2878/docs/iroh_net_bench/iroh/fn.server_endpoint.html
+++ b/pr/2878/docs/iroh_net_bench/iroh/fn.server_endpoint.html
@@ -2,5 +2,5 @@
rt: &Runtime,
relay_url: &Option<RelayUrl>,
opt: &Opt
-) -> (NodeAddr, Endpoint)Expand description
Creates a server endpoint which runs on the given runtime
+) -> (NodeAddr, Endpoint)Expand description
Creates a server endpoint which runs on the given runtime
\ No newline at end of file
diff --git a/pr/2878/docs/portmapper/index.html b/pr/2878/docs/portmapper/index.html
index a2d94115af..1c503b84f6 100644
--- a/pr/2878/docs/portmapper/index.html
+++ b/pr/2878/docs/portmapper/index.html
@@ -1,2 +1,2 @@
-portmapper - Rust Crate portmapper
source · Expand description
Port mapping client and service.
+portmapper - Rust Crate portmapper
source · Expand description
Port mapping client and service.
Structs§
- Port mapping client.
- Configures which port mapping protocols are enabled in the
Service. - Enum of metrics for the module
- Output of a port mapping probe.
- A port mapping client.
\ No newline at end of file
diff --git a/pr/2878/docs/portmapper/struct.Service.html b/pr/2878/docs/portmapper/struct.Service.html
index ac805083f4..c90e6569cf 100644
--- a/pr/2878/docs/portmapper/struct.Service.html
+++ b/pr/2878/docs/portmapper/struct.Service.html
@@ -1,5 +1,5 @@
-Service in portmapper - Rust Struct portmapper::Service
source · pub struct Service { /* private fields */ }
Expand description
A port mapping client.
-Trait Implementations§
Auto Trait Implementations§
§impl Freeze for Service
§impl !RefUnwindSafe for Service
§impl Send for Service
§impl Sync for Service
§impl Unpin for Service
§impl !UnwindSafe for Service
Blanket Implementations§
source§impl<T> Any for Twhere
+Service in portmapper - Rust Struct portmapper::Service
source · pub struct Service { /* private fields */ }
Expand description
A port mapping client.
+Trait Implementations§
Auto Trait Implementations§
§impl Freeze for Service
§impl !RefUnwindSafe for Service
§impl Send for Service
§impl Sync for Service
§impl Unpin for Service
§impl !UnwindSafe for Service
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moresource§impl<T> From<T> for T
source§fn from(t: T) -> T
Returns the argument unchanged.
diff --git a/pr/2878/docs/src/portmapper/lib.rs.html b/pr/2878/docs/src/portmapper/lib.rs.html
index a2aadfed9b..9c18f2a6dc 100644
--- a/pr/2878/docs/src/portmapper/lib.rs.html
+++ b/pr/2878/docs/src/portmapper/lib.rs.html
@@ -713,17 +713,6 @@
713
714
715
-716
-717
-718
-719
-720
-721
-722
-723
-724
-725
-726
//! Port mapping client and service.
use std::{
@@ -978,13 +967,10 @@
inner: (enable_upnp && !upnp).then(|| {
Box::pin(async {
tracing::info!("upnp probe, sleeping");
- tokio::time::timeout(Duration::from_secs(3), async move {
- upnp::probe_available()
- .await
- .map(|addr| (addr, Instant::now()))
- })
- .await
- })
+ upnp::probe_available()
+ .await
+ .map(|addr| (addr, Instant::now()))
+ })
}),
};
@@ -1023,15 +1009,7 @@
tokio::select! {
last_upnp_gateway_addr = &mut upnp_probing_task, if !upnp_done => {
trace!("tick: upnp probe ready");
- match last_upnp_gateway_addr {
- Ok(addr) => {
- probe.last_upnp_gateway_addr = addr;
- }
- Err(_err) => {
- probe.last_upnp_gateway_addr = None;
- tracing::debug!("upnp probe timed out");
- }
- }
+ probe.last_upnp_gateway_addr = last_upnp_gateway_addr;
upnp_done = true;
},
last_nat_pmp = &mut nat_pmp_probing_task, if !nat_pmp_done => {
diff --git a/pr/2878/docs/src/portmapper/upnp.rs.html b/pr/2878/docs/src/portmapper/upnp.rs.html
index 8922ad5dc5..5346754a54 100644
--- a/pr/2878/docs/src/portmapper/upnp.rs.html
+++ b/pr/2878/docs/src/portmapper/upnp.rs.html
@@ -140,6 +140,21 @@
140
141
142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
use std::{
net::{Ipv4Addr, SocketAddrV4},
num::NonZeroU16,
@@ -191,11 +206,15 @@
let gateway = if let Some(known_gateway) = gateway {
known_gateway
} else {
- aigd::tokio::search_gateway(igd_next::SearchOptions {
- timeout: Some(SEARCH_TIMEOUT),
- ..Default::default()
- })
- .await?
+ // Wrap in manual timeout, because igd_next doesn't respect the set timeout
+ tokio::time::timeout(
+ SEARCH_TIMEOUT,
+ aigd::tokio::search_gateway(igd_next::SearchOptions {
+ timeout: Some(SEARCH_TIMEOUT),
+ ..Default::default()
+ }),
+ )
+ .await??
};
let std::net::IpAddr::V4(external_ip) = gateway.get_external_ip().await? else {
@@ -268,18 +287,28 @@
/// Searches for UPnP gateways.
pub async fn probe_available() -> Option<Gateway> {
inc!(Metrics, upnp_probes);
- match aigd::tokio::search_gateway(igd_next::SearchOptions {
- timeout: Some(SEARCH_TIMEOUT),
- ..Default::default()
- })
- .await
- {
- Ok(gateway) => Some(gateway),
+
+ // Wrap in manual timeout, because igd_next doesn't respect the set timeout
+ let res = tokio::time::timeout(
+ SEARCH_TIMEOUT,
+ aigd::tokio::search_gateway(igd_next::SearchOptions {
+ timeout: Some(SEARCH_TIMEOUT),
+ ..Default::default()
+ }),
+ )
+ .await;
+
+ match res {
+ Ok(Ok(gateway)) => Some(gateway),
Err(e) => {
+ inc!(Metrics, upnp_probes_failed);
+ debug!("upnp probe timed out: {e}");
+ None
+ }
+ Ok(Err(e)) => {
inc!(Metrics, upnp_probes_failed);
debug!("upnp probe failed: {e}");
None
}
}
-}
-
\ No newline at end of file
+}
\ No newline at end of file
Variants§
Implementations§
Auto Trait Implementations§
impl Freeze for EndpointSelector
impl !RefUnwindSafe for EndpointSelector
impl Send for EndpointSelector
impl Sync for EndpointSelector
impl Unpin for EndpointSelector
impl !UnwindSafe for EndpointSelector
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
fn implicit(
diff --git a/pr/2878/docs/iroh_net_bench/iroh/fn.connect_client.html b/pr/2878/docs/iroh_net_bench/iroh/fn.connect_client.html
index e440e4b78b..fa168191b6 100644
--- a/pr/2878/docs/iroh_net_bench/iroh/fn.connect_client.html
+++ b/pr/2878/docs/iroh_net_bench/iroh/fn.connect_client.html
@@ -2,5 +2,5 @@
server_addr: NodeAddr,
relay_url: Option<RelayUrl>,
opt: Opt
-) -> Result<(Endpoint, Connection)>Expand description
Create a client endpoint and client connection
+) -> Result<(Endpoint, Connection)>Expand description
Create a client endpoint and client connection
\ No newline at end of file
diff --git a/pr/2878/docs/iroh_net_bench/iroh/fn.server.html b/pr/2878/docs/iroh_net_bench/iroh/fn.server.html
index cfacd00516..8a978024ab 100644
--- a/pr/2878/docs/iroh_net_bench/iroh/fn.server.html
+++ b/pr/2878/docs/iroh_net_bench/iroh/fn.server.html
@@ -1,2 +1,2 @@
-server in iroh_net_bench::iroh - Rust Function iroh_net_bench::iroh::server
source · pub async fn server(endpoint: Endpoint, opt: Opt) -> Result<()>
Expand description
Take the provided endpoint and run the server
+server in iroh_net_bench::iroh - Rust
\ No newline at end of file
diff --git a/pr/2878/docs/iroh_net_bench/iroh/fn.server_endpoint.html b/pr/2878/docs/iroh_net_bench/iroh/fn.server_endpoint.html
index aa3032746c..89f7367650 100644
--- a/pr/2878/docs/iroh_net_bench/iroh/fn.server_endpoint.html
+++ b/pr/2878/docs/iroh_net_bench/iroh/fn.server_endpoint.html
@@ -2,5 +2,5 @@
rt: &Runtime,
relay_url: &Option<RelayUrl>,
opt: &Opt
-) -> (NodeAddr, Endpoint)Expand description
Creates a server endpoint which runs on the given runtime
+) -> (NodeAddr, Endpoint)Expand description
Creates a server endpoint which runs on the given runtime
\ No newline at end of file
diff --git a/pr/2878/docs/portmapper/index.html b/pr/2878/docs/portmapper/index.html
index a2d94115af..1c503b84f6 100644
--- a/pr/2878/docs/portmapper/index.html
+++ b/pr/2878/docs/portmapper/index.html
@@ -1,2 +1,2 @@
-portmapper - Rust Crate portmapper
source · Expand description
Port mapping client and service.
+portmapper - Rust Crate portmapper
source · Expand description
Port mapping client and service.
Structs§
- Port mapping client.
- Configures which port mapping protocols are enabled in the
Service. - Enum of metrics for the module
- Output of a port mapping probe.
- A port mapping client.
\ No newline at end of file
diff --git a/pr/2878/docs/portmapper/struct.Service.html b/pr/2878/docs/portmapper/struct.Service.html
index ac805083f4..c90e6569cf 100644
--- a/pr/2878/docs/portmapper/struct.Service.html
+++ b/pr/2878/docs/portmapper/struct.Service.html
@@ -1,5 +1,5 @@
-Service in portmapper - Rust Struct portmapper::Service
source · pub struct Service { /* private fields */ }
Expand description
A port mapping client.
-Trait Implementations§
Auto Trait Implementations§
§impl Freeze for Service
§impl !RefUnwindSafe for Service
§impl Send for Service
§impl Sync for Service
§impl Unpin for Service
§impl !UnwindSafe for Service
Blanket Implementations§
source§impl<T> Any for Twhere
+Service in portmapper - Rust Struct portmapper::Service
source · pub struct Service { /* private fields */ }
Expand description
A port mapping client.
+Trait Implementations§
Auto Trait Implementations§
§impl Freeze for Service
§impl !RefUnwindSafe for Service
§impl Send for Service
§impl Sync for Service
§impl Unpin for Service
§impl !UnwindSafe for Service
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moresource§impl<T> From<T> for T
source§fn from(t: T) -> T
Returns the argument unchanged.
diff --git a/pr/2878/docs/src/portmapper/lib.rs.html b/pr/2878/docs/src/portmapper/lib.rs.html
index a2aadfed9b..9c18f2a6dc 100644
--- a/pr/2878/docs/src/portmapper/lib.rs.html
+++ b/pr/2878/docs/src/portmapper/lib.rs.html
@@ -713,17 +713,6 @@
713
714
715
-716
-717
-718
-719
-720
-721
-722
-723
-724
-725
-726
//! Port mapping client and service.
use std::{
@@ -978,13 +967,10 @@
inner: (enable_upnp && !upnp).then(|| {
Box::pin(async {
tracing::info!("upnp probe, sleeping");
- tokio::time::timeout(Duration::from_secs(3), async move {
- upnp::probe_available()
- .await
- .map(|addr| (addr, Instant::now()))
- })
- .await
- })
+ upnp::probe_available()
+ .await
+ .map(|addr| (addr, Instant::now()))
+ })
}),
};
@@ -1023,15 +1009,7 @@
tokio::select! {
last_upnp_gateway_addr = &mut upnp_probing_task, if !upnp_done => {
trace!("tick: upnp probe ready");
- match last_upnp_gateway_addr {
- Ok(addr) => {
- probe.last_upnp_gateway_addr = addr;
- }
- Err(_err) => {
- probe.last_upnp_gateway_addr = None;
- tracing::debug!("upnp probe timed out");
- }
- }
+ probe.last_upnp_gateway_addr = last_upnp_gateway_addr;
upnp_done = true;
},
last_nat_pmp = &mut nat_pmp_probing_task, if !nat_pmp_done => {
diff --git a/pr/2878/docs/src/portmapper/upnp.rs.html b/pr/2878/docs/src/portmapper/upnp.rs.html
index 8922ad5dc5..5346754a54 100644
--- a/pr/2878/docs/src/portmapper/upnp.rs.html
+++ b/pr/2878/docs/src/portmapper/upnp.rs.html
@@ -140,6 +140,21 @@
140
141
142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
use std::{
net::{Ipv4Addr, SocketAddrV4},
num::NonZeroU16,
@@ -191,11 +206,15 @@
let gateway = if let Some(known_gateway) = gateway {
known_gateway
} else {
- aigd::tokio::search_gateway(igd_next::SearchOptions {
- timeout: Some(SEARCH_TIMEOUT),
- ..Default::default()
- })
- .await?
+ // Wrap in manual timeout, because igd_next doesn't respect the set timeout
+ tokio::time::timeout(
+ SEARCH_TIMEOUT,
+ aigd::tokio::search_gateway(igd_next::SearchOptions {
+ timeout: Some(SEARCH_TIMEOUT),
+ ..Default::default()
+ }),
+ )
+ .await??
};
let std::net::IpAddr::V4(external_ip) = gateway.get_external_ip().await? else {
@@ -268,18 +287,28 @@
/// Searches for UPnP gateways.
pub async fn probe_available() -> Option<Gateway> {
inc!(Metrics, upnp_probes);
- match aigd::tokio::search_gateway(igd_next::SearchOptions {
- timeout: Some(SEARCH_TIMEOUT),
- ..Default::default()
- })
- .await
- {
- Ok(gateway) => Some(gateway),
+
+ // Wrap in manual timeout, because igd_next doesn't respect the set timeout
+ let res = tokio::time::timeout(
+ SEARCH_TIMEOUT,
+ aigd::tokio::search_gateway(igd_next::SearchOptions {
+ timeout: Some(SEARCH_TIMEOUT),
+ ..Default::default()
+ }),
+ )
+ .await;
+
+ match res {
+ Ok(Ok(gateway)) => Some(gateway),
Err(e) => {
+ inc!(Metrics, upnp_probes_failed);
+ debug!("upnp probe timed out: {e}");
+ None
+ }
+ Ok(Err(e)) => {
inc!(Metrics, upnp_probes_failed);
debug!("upnp probe failed: {e}");
None
}
}
-}
-
\ No newline at end of file
+}
\ No newline at end of file
Expand description
Create a client endpoint and client connection
+) -> Result<(Endpoint, Connection)>Expand description
Create a client endpoint and client connection
Function iroh_net_bench::iroh::server
source · pub async fn server(endpoint: Endpoint, opt: Opt) -> Result<()>Expand description
Take the provided endpoint and run the server
+Expand description
Creates a server endpoint which runs on the given runtime
+) -> (NodeAddr, Endpoint)Expand description
Creates a server endpoint which runs on the given runtime
Crate portmapper
source ·Expand description
Port mapping client and service.
+Crate portmapper
source ·Expand description
Port mapping client and service.
Structs§
- Port mapping client.
- Configures which port mapping protocols are enabled in the
Service. - Enum of metrics for the module
- Output of a port mapping probe.
- A port mapping client.
Struct portmapper::Service
source · pub struct Service { /* private fields */ }Expand description
A port mapping client.
-Trait Implementations§
Auto Trait Implementations§
impl Freeze for Service
impl !RefUnwindSafe for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl !UnwindSafe for Service
Blanket Implementations§
source§impl<T> Any for Twhere
+Service in portmapper - Rust Struct portmapper::Service
source · pub struct Service { /* private fields */ }
Expand description
A port mapping client.
+Trait Implementations§
Auto Trait Implementations§
§impl Freeze for Service
§impl !RefUnwindSafe for Service
§impl Send for Service
§impl Sync for Service
§impl Unpin for Service
§impl !UnwindSafe for Service
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moresource§impl<T> From<T> for T
source§fn from(t: T) -> T
Returns the argument unchanged.
diff --git a/pr/2878/docs/src/portmapper/lib.rs.html b/pr/2878/docs/src/portmapper/lib.rs.html
index a2aadfed9b..9c18f2a6dc 100644
--- a/pr/2878/docs/src/portmapper/lib.rs.html
+++ b/pr/2878/docs/src/portmapper/lib.rs.html
@@ -713,17 +713,6 @@
713
714
715
-716
-717
-718
-719
-720
-721
-722
-723
-724
-725
-726
//! Port mapping client and service.
use std::{
@@ -978,13 +967,10 @@
inner: (enable_upnp && !upnp).then(|| {
Box::pin(async {
tracing::info!("upnp probe, sleeping");
- tokio::time::timeout(Duration::from_secs(3), async move {
- upnp::probe_available()
- .await
- .map(|addr| (addr, Instant::now()))
- })
- .await
- })
+ upnp::probe_available()
+ .await
+ .map(|addr| (addr, Instant::now()))
+ })
}),
};
@@ -1023,15 +1009,7 @@
tokio::select! {
last_upnp_gateway_addr = &mut upnp_probing_task, if !upnp_done => {
trace!("tick: upnp probe ready");
- match last_upnp_gateway_addr {
- Ok(addr) => {
- probe.last_upnp_gateway_addr = addr;
- }
- Err(_err) => {
- probe.last_upnp_gateway_addr = None;
- tracing::debug!("upnp probe timed out");
- }
- }
+ probe.last_upnp_gateway_addr = last_upnp_gateway_addr;
upnp_done = true;
},
last_nat_pmp = &mut nat_pmp_probing_task, if !nat_pmp_done => {
diff --git a/pr/2878/docs/src/portmapper/upnp.rs.html b/pr/2878/docs/src/portmapper/upnp.rs.html
index 8922ad5dc5..5346754a54 100644
--- a/pr/2878/docs/src/portmapper/upnp.rs.html
+++ b/pr/2878/docs/src/portmapper/upnp.rs.html
@@ -140,6 +140,21 @@
140
141
142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
use std::{
net::{Ipv4Addr, SocketAddrV4},
num::NonZeroU16,
@@ -191,11 +206,15 @@
let gateway = if let Some(known_gateway) = gateway {
known_gateway
} else {
- aigd::tokio::search_gateway(igd_next::SearchOptions {
- timeout: Some(SEARCH_TIMEOUT),
- ..Default::default()
- })
- .await?
+ // Wrap in manual timeout, because igd_next doesn't respect the set timeout
+ tokio::time::timeout(
+ SEARCH_TIMEOUT,
+ aigd::tokio::search_gateway(igd_next::SearchOptions {
+ timeout: Some(SEARCH_TIMEOUT),
+ ..Default::default()
+ }),
+ )
+ .await??
};
let std::net::IpAddr::V4(external_ip) = gateway.get_external_ip().await? else {
@@ -268,18 +287,28 @@
/// Searches for UPnP gateways.
pub async fn probe_available() -> Option<Gateway> {
inc!(Metrics, upnp_probes);
- match aigd::tokio::search_gateway(igd_next::SearchOptions {
- timeout: Some(SEARCH_TIMEOUT),
- ..Default::default()
- })
- .await
- {
- Ok(gateway) => Some(gateway),
+
+ // Wrap in manual timeout, because igd_next doesn't respect the set timeout
+ let res = tokio::time::timeout(
+ SEARCH_TIMEOUT,
+ aigd::tokio::search_gateway(igd_next::SearchOptions {
+ timeout: Some(SEARCH_TIMEOUT),
+ ..Default::default()
+ }),
+ )
+ .await;
+
+ match res {
+ Ok(Ok(gateway)) => Some(gateway),
Err(e) => {
+ inc!(Metrics, upnp_probes_failed);
+ debug!("upnp probe timed out: {e}");
+ None
+ }
+ Ok(Err(e)) => {
inc!(Metrics, upnp_probes_failed);
debug!("upnp probe failed: {e}");
None
}
}
-}
-
\ No newline at end of file
+}
\ No newline at end of file
impl<T> Any for Twhere
+Service in portmapper - Rust Struct portmapper::Service
source · pub struct Service { /* private fields */ }
Expand description
A port mapping client.
+Trait Implementations§
Auto Trait Implementations§
§impl Freeze for Service
§impl !RefUnwindSafe for Service
§impl Send for Service
§impl Sync for Service
§impl Unpin for Service
§impl !UnwindSafe for Service
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moresource§impl<T> From<T> for T
source§fn from(t: T) -> T
Returns the argument unchanged.
diff --git a/pr/2878/docs/src/portmapper/lib.rs.html b/pr/2878/docs/src/portmapper/lib.rs.html
index a2aadfed9b..9c18f2a6dc 100644
--- a/pr/2878/docs/src/portmapper/lib.rs.html
+++ b/pr/2878/docs/src/portmapper/lib.rs.html
@@ -713,17 +713,6 @@
713
714
715
-716
-717
-718
-719
-720
-721
-722
-723
-724
-725
-726
//! Port mapping client and service.
use std::{
@@ -978,13 +967,10 @@
inner: (enable_upnp && !upnp).then(|| {
Box::pin(async {
tracing::info!("upnp probe, sleeping");
- tokio::time::timeout(Duration::from_secs(3), async move {
- upnp::probe_available()
- .await
- .map(|addr| (addr, Instant::now()))
- })
- .await
- })
+ upnp::probe_available()
+ .await
+ .map(|addr| (addr, Instant::now()))
+ })
}),
};
@@ -1023,15 +1009,7 @@
tokio::select! {
last_upnp_gateway_addr = &mut upnp_probing_task, if !upnp_done => {
trace!("tick: upnp probe ready");
- match last_upnp_gateway_addr {
- Ok(addr) => {
- probe.last_upnp_gateway_addr = addr;
- }
- Err(_err) => {
- probe.last_upnp_gateway_addr = None;
- tracing::debug!("upnp probe timed out");
- }
- }
+ probe.last_upnp_gateway_addr = last_upnp_gateway_addr;
upnp_done = true;
},
last_nat_pmp = &mut nat_pmp_probing_task, if !nat_pmp_done => {
diff --git a/pr/2878/docs/src/portmapper/upnp.rs.html b/pr/2878/docs/src/portmapper/upnp.rs.html
index 8922ad5dc5..5346754a54 100644
--- a/pr/2878/docs/src/portmapper/upnp.rs.html
+++ b/pr/2878/docs/src/portmapper/upnp.rs.html
@@ -140,6 +140,21 @@
140
141
142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
use std::{
net::{Ipv4Addr, SocketAddrV4},
num::NonZeroU16,
@@ -191,11 +206,15 @@
let gateway = if let Some(known_gateway) = gateway {
known_gateway
} else {
- aigd::tokio::search_gateway(igd_next::SearchOptions {
- timeout: Some(SEARCH_TIMEOUT),
- ..Default::default()
- })
- .await?
+ // Wrap in manual timeout, because igd_next doesn't respect the set timeout
+ tokio::time::timeout(
+ SEARCH_TIMEOUT,
+ aigd::tokio::search_gateway(igd_next::SearchOptions {
+ timeout: Some(SEARCH_TIMEOUT),
+ ..Default::default()
+ }),
+ )
+ .await??
};
let std::net::IpAddr::V4(external_ip) = gateway.get_external_ip().await? else {
@@ -268,18 +287,28 @@
/// Searches for UPnP gateways.
pub async fn probe_available() -> Option<Gateway> {
inc!(Metrics, upnp_probes);
- match aigd::tokio::search_gateway(igd_next::SearchOptions {
- timeout: Some(SEARCH_TIMEOUT),
- ..Default::default()
- })
- .await
- {
- Ok(gateway) => Some(gateway),
+
+ // Wrap in manual timeout, because igd_next doesn't respect the set timeout
+ let res = tokio::time::timeout(
+ SEARCH_TIMEOUT,
+ aigd::tokio::search_gateway(igd_next::SearchOptions {
+ timeout: Some(SEARCH_TIMEOUT),
+ ..Default::default()
+ }),
+ )
+ .await;
+
+ match res {
+ Ok(Ok(gateway)) => Some(gateway),
Err(e) => {
+ inc!(Metrics, upnp_probes_failed);
+ debug!("upnp probe timed out: {e}");
+ None
+ }
+ Ok(Err(e)) => {
inc!(Metrics, upnp_probes_failed);
debug!("upnp probe failed: {e}");
None
}
}
-}
-
\ No newline at end of file
+}
\ No newline at end of file
Struct portmapper::Service
source · pub struct Service { /* private fields */ }Expand description
A port mapping client.
+Trait Implementations§
Auto Trait Implementations§
impl Freeze for Service
impl !RefUnwindSafe for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl !UnwindSafe for Service
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> From<T> for T
impl<T> From<T> for T
source§fn from(t: T) -> T
fn from(t: T) -> T
Returns the argument unchanged.
diff --git a/pr/2878/docs/src/portmapper/lib.rs.html b/pr/2878/docs/src/portmapper/lib.rs.html index a2aadfed9b..9c18f2a6dc 100644 --- a/pr/2878/docs/src/portmapper/lib.rs.html +++ b/pr/2878/docs/src/portmapper/lib.rs.html @@ -713,17 +713,6 @@ 713 714 715 -716 -717 -718 -719 -720 -721 -722 -723 -724 -725 -726//! Port mapping client and service.
use std::{
@@ -978,13 +967,10 @@
inner: (enable_upnp && !upnp).then(|| {
Box::pin(async {
tracing::info!("upnp probe, sleeping");
- tokio::time::timeout(Duration::from_secs(3), async move {
- upnp::probe_available()
- .await
- .map(|addr| (addr, Instant::now()))
- })
- .await
- })
+ upnp::probe_available()
+ .await
+ .map(|addr| (addr, Instant::now()))
+ })
}),
};
@@ -1023,15 +1009,7 @@
tokio::select! {
last_upnp_gateway_addr = &mut upnp_probing_task, if !upnp_done => {
trace!("tick: upnp probe ready");
- match last_upnp_gateway_addr {
- Ok(addr) => {
- probe.last_upnp_gateway_addr = addr;
- }
- Err(_err) => {
- probe.last_upnp_gateway_addr = None;
- tracing::debug!("upnp probe timed out");
- }
- }
+ probe.last_upnp_gateway_addr = last_upnp_gateway_addr;
upnp_done = true;
},
last_nat_pmp = &mut nat_pmp_probing_task, if !nat_pmp_done => {
diff --git a/pr/2878/docs/src/portmapper/upnp.rs.html b/pr/2878/docs/src/portmapper/upnp.rs.html
index 8922ad5dc5..5346754a54 100644
--- a/pr/2878/docs/src/portmapper/upnp.rs.html
+++ b/pr/2878/docs/src/portmapper/upnp.rs.html
@@ -140,6 +140,21 @@
140
141
142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
use std::{
net::{Ipv4Addr, SocketAddrV4},
num::NonZeroU16,
@@ -191,11 +206,15 @@
let gateway = if let Some(known_gateway) = gateway {
known_gateway
} else {
- aigd::tokio::search_gateway(igd_next::SearchOptions {
- timeout: Some(SEARCH_TIMEOUT),
- ..Default::default()
- })
- .await?
+ // Wrap in manual timeout, because igd_next doesn't respect the set timeout
+ tokio::time::timeout(
+ SEARCH_TIMEOUT,
+ aigd::tokio::search_gateway(igd_next::SearchOptions {
+ timeout: Some(SEARCH_TIMEOUT),
+ ..Default::default()
+ }),
+ )
+ .await??
};
let std::net::IpAddr::V4(external_ip) = gateway.get_external_ip().await? else {
@@ -268,18 +287,28 @@
/// Searches for UPnP gateways.
pub async fn probe_available() -> Option<Gateway> {
inc!(Metrics, upnp_probes);
- match aigd::tokio::search_gateway(igd_next::SearchOptions {
- timeout: Some(SEARCH_TIMEOUT),
- ..Default::default()
- })
- .await
- {
- Ok(gateway) => Some(gateway),
+
+ // Wrap in manual timeout, because igd_next doesn't respect the set timeout
+ let res = tokio::time::timeout(
+ SEARCH_TIMEOUT,
+ aigd::tokio::search_gateway(igd_next::SearchOptions {
+ timeout: Some(SEARCH_TIMEOUT),
+ ..Default::default()
+ }),
+ )
+ .await;
+
+ match res {
+ Ok(Ok(gateway)) => Some(gateway),
Err(e) => {
+ inc!(Metrics, upnp_probes_failed);
+ debug!("upnp probe timed out: {e}");
+ None
+ }
+ Ok(Err(e)) => {
inc!(Metrics, upnp_probes_failed);
debug!("upnp probe failed: {e}");
None
}
}
-}
-