\ No newline at end of file
diff --git a/pr/3139/docs/iroh_net_report/fn.bind_local_stun_socket.html b/pr/3139/docs/iroh_net_report/fn.bind_local_stun_socket.html
index d609a6ced6..ed1c121f2f 100644
--- a/pr/3139/docs/iroh_net_report/fn.bind_local_stun_socket.html
+++ b/pr/3139/docs/iroh_net_report/fn.bind_local_stun_socket.html
@@ -1,4 +1,4 @@
-bind_local_stun_socket in iroh_net_report - Rust
Test if IPv6 works at all, or if it’s been hard disabled at the OS level.
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_net_report/index.html b/pr/3139/docs/iroh_net_report/index.html
index 232bd78e9f..9a92939804 100644
--- a/pr/3139/docs/iroh_net_report/index.html
+++ b/pr/3139/docs/iroh_net_report/index.html
@@ -1,6 +1,6 @@
-iroh_net_report - Rust
Checks the network conditions from the current host.
NetReport is responsible for finding out the network conditions of the current host, like
whether it is connected to the internet via IPv4 and/or IPv6, what the NAT situation is
etc and reachability to the configured relays.
Test if IPv6 works at all, or if it’s been hard disabled at the OS level.
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_net_report/sidebar-items.js b/pr/3139/docs/iroh_net_report/sidebar-items.js
index d6cfab3114..0b7c84fd64 100644
--- a/pr/3139/docs/iroh_net_report/sidebar-items.js
+++ b/pr/3139/docs/iroh_net_report/sidebar-items.js
@@ -1 +1 @@
-window.SIDEBAR_ITEMS = {"fn":["bind_local_stun_socket","os_has_ipv6"],"mod":["task","time"],"struct":["Addr","Client","Metrics","Options","QuicConfig","RelayLatencies","Report"]};
\ No newline at end of file
+window.SIDEBAR_ITEMS = {"fn":["bind_local_stun_socket","os_has_ipv6"],"mod":["task"],"struct":["Addr","Client","Metrics","Options","QuicConfig","RelayLatencies","Report"]};
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_net_report/struct.Addr.html b/pr/3139/docs/iroh_net_report/struct.Addr.html
index ae514d4832..5ca6c91e0c 100644
--- a/pr/3139/docs/iroh_net_report/struct.Addr.html
+++ b/pr/3139/docs/iroh_net_report/struct.Addr.html
@@ -1,7 +1,7 @@
-Addr in iroh_net_report - Rust
Unlike Client this is the raw channel to send messages over. Keeping this alive
will not keep the actor alive, which makes this handy to pass to internal tasks.
Normally the UDP sockets to send STUN messages from are passed in so that STUN
packets are sent from the sockets that carry the real traffic. However because
these sockets carry real traffic they will also receive non-STUN traffic, thus the
@@ -11,7 +11,7 @@ packet on the socket you should pass it to this method.
in-flight STUN probes. The actor will simply ignore any stray STUN packets.
There is an implicit queue here which may drop packets if the actor does not keep up
consuming them.
Creating this creates a net_report actor which runs in the background. Most of the time
it is idle unless Client::get_report is called, which is the main interface.
The Client struct can be cloned and results multiple handles to the running actor.
If all Clients are dropped the actor stops running.
While running the net_report actor expects to be passed all received stun packets using
Addr::receive_stun_packet.
pub async fn get_report(
&mut self,
relay_map: RelayMap,
stun_sock_v4: Option<Arc<UdpSocket>>,
@@ -36,20 +36,20 @@ When available, the report will attempt to get an observed public address
using QUIC address discovery.
When None, it will disable the QUIC address discovery probes.
Spawns a new asynchronous task, returning a
+ <F as Future>::Output: Send + 'static,
Available on non-wasm_browser only.
Expand description
Spawns a new asynchronous task, returning a
JoinHandle for it.
The provided future will start running in the background immediately
when spawn is called, even if you don’t await the returned
diff --git a/pr/3139/docs/iroh_net_report/task/index.html b/pr/3139/docs/iroh_net_report/task/index.html
index 0d0f211a41..43e62f5c84 100644
--- a/pr/3139/docs/iroh_net_report/task/index.html
+++ b/pr/3139/docs/iroh_net_report/task/index.html
@@ -1,5 +1,5 @@
-
Spawns a new asynchronous task, returning a
JoinHandle for it.
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_net_report/task/struct.AbortOnDropHandle.html b/pr/3139/docs/iroh_net_report/task/struct.AbortOnDropHandle.html
index 2bb12f0830..8143989a08 100644
--- a/pr/3139/docs/iroh_net_report/task/struct.AbortOnDropHandle.html
+++ b/pr/3139/docs/iroh_net_report/task/struct.AbortOnDropHandle.html
@@ -1,11 +1,11 @@
-AbortOnDropHandle in iroh_net_report::task - Rust
into_panic() panics if the Error does not represent the underlying
task terminating with a panic. Use is_panic to check the error reason
@@ -32,7 +32,7 @@ or try_into_panic for a variant that does not panic.
An owned permission to join on a task (await its termination).
This can be thought of as the equivalent of std::thread::JoinHandle
for a Tokio task rather than a thread. Note that the background task
associated with this JoinHandle started running immediately when you
@@ -101,7 +101,7 @@ original_task.await.expect("The tas
// task returns.
time::sleep(Duration::from_millis(1000)).await;
Awaiting a cancelled task might complete as usual if the task was
already completed at the time it was cancelled, but most likely it
will fail with a cancelledJoinError.
@@ -133,7 +133,7 @@ handles.push(tokio::spawn(async {
for handle in handles {
assert!(handle.await.unwrap_err().is_cancelled());
}
Checks if the task associated with this JoinHandle has finished.
Please note that this method can return false even if abort has been
called on the task. This is because the cancellation process may take
some time, and this method does not return true until it has
@@ -153,7 +153,7 @@ completed.
Returns a new AbortHandle that can be used to remotely abort this task.
Awaiting a task cancelled by the AbortHandle might complete as usual if the task was
already completed at the time it was cancelled, but most likely it
will fail with a cancelledJoinError.
@@ -181,7 +181,7 @@ handles.push(tokio::spawn(async {
for handle in handles {
assert!(handle.await.unwrap_err().is_cancelled());
}
A JoinSet can be used to await the completion of some or all of the tasks
in the set. The set is not ordered, and the tasks will be returned in the
order they complete.
@@ -27,13 +27,13 @@ order they complete.
assert!(seen[i]);
}
}
Spawn the provided task on the JoinSet, returning an AbortHandle
+ T: Send,
Spawn the provided task on the JoinSet, returning an AbortHandle
that can be used to remotely cancel the task.
The provided future will start running in the background immediately
when this method is called, even if you don’t await anything on this
@@ -42,14 +42,14 @@ when this method is called, even if you don’t await anything on this
This method panics if called outside of a Tokio runtime.
Spawn the provided task on the current LocalSet and store it in this
+ F: Future<Output = T> + 'static,
Spawn the provided task on the current LocalSet and store it in this
JoinSet, returning an AbortHandle that can be used to remotely
cancel the task.
The provided future will start running in the background immediately
@@ -62,7 +62,7 @@ when this method is called, even if you don’t await anything on this
task: F,
local_set: &LocalSet,
) -> AbortHandle
Spawn the provided task on the provided LocalSet and store it in
+ F: Future<Output = T> + 'static,
Spawn the provided task on the provided LocalSet and store it in
this JoinSet, returning an AbortHandle that can be used to
remotely cancel the task.
Unlike the spawn_local method, this method may be used to spawn local
@@ -70,7 +70,7 @@ tasks on a LocalSet that is not currently running. The pro
future will start running whenever the LocalSet is next started.
Spawn the blocking code on the blocking threadpool and store
+ T: Send,
Spawn the blocking code on the blocking threadpool and store
it in this JoinSet, returning an AbortHandle that can be
used to remotely cancel the task.
Spawn the blocking code on the blocking threadpool of the
+ T: Send,
Spawn the blocking code on the blocking threadpool of the
provided runtime and store it in this JoinSet, returning an
AbortHandle that can be used to remotely cancel the task.
This method is cancel safe. If join_next is used as the event in a tokio::select!
statement and some other branch completes first, it is guaranteed that no tasks were
removed from this JoinSet.
Awaits the completion of all tasks in this JoinSet, returning a vector of their results.
The results will be stored in the order they completed not the order they were spawned.
This is a convenience method that is equivalent to calling join_next in
a loop. If any tasks on the JoinSet fail with an JoinError, then this call
@@ -180,16 +180,16 @@ in a loop.
This does not remove the tasks from the JoinSet. To wait for the tasks to complete
cancellation, you should call join_next in a loop until the JoinSet is empty.
Polls for one of the tasks in the set to complete.
If this returns Poll::Ready(Some(_)), then the task that completed is removed from the set.
When the method returns Poll::Pending, the Waker in the provided Context is scheduled
to receive a wakeup when a task in the JoinSet completes. Note that on multiple calls to
@@ -211,7 +211,7 @@ This can happen if the coop budget<
Polls for one of the tasks in the set to complete.
If this returns Poll::Ready(Some(_)), then the task that completed is removed from the set.
When the method returns Poll::Pending, the Waker in the provided Context is scheduled
to receive a wakeup when a task in the JoinSet completes. Note that on multiple calls to
diff --git a/pr/3139/docs/iroh_net_report/task/tokio/fn.spawn.html b/pr/3139/docs/iroh_net_report/task/tokio/fn.spawn.html
deleted file mode 100644
index c3f3303a4b..0000000000
--- a/pr/3139/docs/iroh_net_report/task/tokio/fn.spawn.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
Defines the behavior of an Interval when it misses a tick.
-
Sometimes, an Interval’s tick is missed. For example, consider the
-following:
-
-
use tokio::time::{self, Duration};
-
-#[tokio::main]
-async fn main() {
- // ticks every 2 milliseconds
- let mut interval = time::interval(Duration::from_millis(2));
- for _ in 0..5 {
- interval.tick().await;
- // if this takes more than 2 milliseconds, a tick will be delayed
- task_that_takes_one_to_three_millis().await;
- }
-}
-
Generally, a tick is missed if too much time is spent without calling
-Interval::tick().
-
By default, when a tick is missed, Interval fires ticks as quickly as it
-can until it is “caught up” in time to where it should be.
-MissedTickBehavior can be used to specify a different behavior for
-Interval to exhibit. Each variant represents a different strategy.
-
Note that because the executor cannot guarantee exact precision with timers,
-these strategies will only apply when the delay is greater than 5
-milliseconds.
When this strategy is used, Interval schedules ticks “normally” (the
-same as it would have if the ticks hadn’t been delayed), which results
-in it firing ticks as fast as possible until it is caught up in time to
-where it should be. Unlike Delay and Skip, the ticks yielded
-when Burst is used (the Instants that tick
-yields) aren’t different than they would have been if a tick had not
-been missed. Like Skip, and unlike Delay, the ticks may be
-shortened.
-
This looks something like this:
-
Expected ticks: | 1 | 2 | 3 | 4 | 5 | 6 |
-Actual ticks: | work -----| delay | work | work | work -| work -----|
-
In code:
-
-
use tokio::time::{interval, Duration};
-
-let mut interval = interval(Duration::from_millis(50));
-
-// First tick resolves immediately after creation
-interval.tick().await;
-
-task_that_takes_200_millis().await;
-// The `Interval` has missed a tick
-
-// Since we have exceeded our timeout, this will resolve immediately
-interval.tick().await;
-
-// Since we are more than 100ms after the start of `interval`, this will
-// also resolve immediately.
-interval.tick().await;
-
-// Also resolves immediately, because it was supposed to resolve at
-// 150ms after the start of `interval`
-interval.tick().await;
-
-// Resolves immediately
-interval.tick().await;
-
-// Since we have gotten to 200ms after the start of `interval`, this
-// will resolve after 50ms
-interval.tick().await;
Tick at multiples of period from when tick was called, rather than
-from start.
-
When this strategy is used and Interval has missed a tick, instead
-of scheduling ticks to fire at multiples of period from start (the
-time when the first tick was fired), it schedules all future ticks to
-happen at a regular period from the point when tick was called.
-Unlike Burst and Skip, ticks are not shortened, and they aren’t
-guaranteed to happen at a multiple of period from start any longer.
-
This looks something like this:
-
Expected ticks: | 1 | 2 | 3 | 4 | 5 | 6 |
-Actual ticks: | work -----| delay | work -----| work -----| work -----|
-
In code:
-
-
use tokio::time::{interval, Duration, MissedTickBehavior};
-
-let mut interval = interval(Duration::from_millis(50));
-interval.set_missed_tick_behavior(MissedTickBehavior::Delay);
-
-task_that_takes_more_than_50_millis().await;
-// The `Interval` has missed a tick
-
-// Since we have exceeded our timeout, this will resolve immediately
-interval.tick().await;
-
-// But this one, rather than also resolving immediately, as might happen
-// with the `Burst` or `Skip` behaviors, will not resolve until
-// 50ms after the call to `tick` up above. That is, in `tick`, when we
-// recognize that we missed a tick, we schedule the next tick to happen
-// 50ms (or whatever the `period` is) from right then, not from when
-// were *supposed* to tick
-interval.tick().await;
Skips missed ticks and tick on the next multiple of period from
-start.
-
When this strategy is used, Interval schedules the next tick to fire
-at the next-closest tick that is a multiple of period away from
-start (the point where Interval first ticked). Like Burst, all
-ticks remain multiples of period away from start, but unlike
-Burst, the ticks may not be one multiple of period away from the
-last tick. Like Delay, the ticks are no longer the same as they
-would have been if ticks had not been missed, but unlike Delay, and
-like Burst, the ticks may be shortened to be less than one period
-away from each other.
-
This looks something like this:
-
Expected ticks: | 1 | 2 | 3 | 4 | 5 | 6 |
-Actual ticks: | work -----| delay | work ---| work -----| work -----|
-
In code:
-
-
use tokio::time::{interval, Duration, MissedTickBehavior};
-
-let mut interval = interval(Duration::from_millis(50));
-interval.set_missed_tick_behavior(MissedTickBehavior::Skip);
-
-task_that_takes_75_millis().await;
-// The `Interval` has missed a tick
-
-// Since we have exceeded our timeout, this will resolve immediately
-interval.tick().await;
-
-// This one will resolve after 25ms, 100ms after the start of
-// `interval`, which is the closest multiple of `period` from the start
-// of `interval` after the call to `tick` up above.
-interval.tick().await;
For most usecases, the Burst strategy is what is desired.
-Additionally, to preserve backwards compatibility, the Burst
-strategy must be the default. For these reasons,
-MissedTickBehavior::Burst is the default for MissedTickBehavior.
-See Burst for more details.
Currently, there are two different errors that can occur:
-
-
-
shutdown occurs when a timer operation is attempted, but the timer
-instance has been dropped. In this case, the operation will never be able
-to complete and the shutdown error is returned. This is a permanent
-error, i.e., once this error is observed, timer operations will never
-succeed in the future.
-
-
-
at_capacity occurs when a timer operation is attempted, but the timer
-instance is currently handling its maximum number of outstanding sleep instances.
-In this case, the operation is not able to be performed at the current
-moment, and at_capacity is returned. This is a transient error, i.e., at
-some point in the future, if the operation is attempted again, it might
-succeed. Callers that observe this error should attempt to shed load. One
-way to do this would be dropping the future that issued the timer operation.
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_net_report/time/fn.interval.html b/pr/3139/docs/iroh_net_report/time/fn.interval.html
deleted file mode 100644
index d532118d4c..0000000000
--- a/pr/3139/docs/iroh_net_report/time/fn.interval.html
+++ /dev/null
@@ -1,48 +0,0 @@
-interval in iroh_net_report::time - Rust
use tokio::time::{self, Duration};
-
-#[tokio::main]
-async fn main() {
- let mut interval = time::interval(Duration::from_millis(10));
-
- interval.tick().await; // ticks immediately
- interval.tick().await; // ticks after 10ms
- interval.tick().await; // ticks after 10ms
-
- // approximately 20ms have elapsed.
-}
-
A simple example using interval to execute a task every two seconds.
-
The difference between interval and sleep is that an Interval
-measures the time since the last tick, which means that .tick().await
-may wait for a shorter time than the duration specified for the interval
-if some time has passed between calls to .tick().await.
-
If the tick in the example below was replaced with sleep, the task
-would only be executed once every three seconds, and not every two
-seconds.
-
-
use tokio::time;
-
-async fn task_that_takes_a_second() {
- println!("hello");
- time::sleep(time::Duration::from_secs(1)).await
-}
-
-#[tokio::main]
-async fn main() {
- let mut interval = time::interval(time::Duration::from_secs(2));
- for _i in 0..5 {
- interval.tick().await;
- task_that_takes_a_second().await;
- }
-}
-
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_net_report/time/fn.interval_at.html b/pr/3139/docs/iroh_net_report/time/fn.interval_at.html
deleted file mode 100644
index bc9d4ca31d..0000000000
--- a/pr/3139/docs/iroh_net_report/time/fn.interval_at.html
+++ /dev/null
@@ -1,23 +0,0 @@
-interval_at in iroh_net_report::time - Rust
use tokio::time::{interval_at, Duration, Instant};
-
-#[tokio::main]
-async fn main() {
- let start = Instant::now() + Duration::from_millis(50);
- let mut interval = interval_at(start, Duration::from_millis(10));
-
- interval.tick().await; // ticks after 50ms
- interval.tick().await; // ticks after 10ms
- interval.tick().await; // ticks after 10ms
-
- // approximately 70ms have elapsed.
-}
-
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_net_report/time/fn.sleep.html b/pr/3139/docs/iroh_net_report/time/fn.sleep.html
deleted file mode 100644
index c7aad6a9c9..0000000000
--- a/pr/3139/docs/iroh_net_report/time/fn.sleep.html
+++ /dev/null
@@ -1,36 +0,0 @@
-sleep in iroh_net_report::time - Rust
Equivalent to sleep_until(Instant::now() + duration). An asynchronous
-analog to std::thread::sleep.
-
No work is performed while awaiting on the sleep future to complete. Sleep
-operates at millisecond granularity and should not be used for tasks that
-require high-resolution timers. The implementation is platform specific,
-and some platforms (specifically Windows) will provide timers with a
-larger resolution than 1 ms.
-
To run something regularly on a schedule, see interval.
-
The maximum duration for a sleep is 68719476734 milliseconds (approximately 2.2 years).
It can also panic whenever a timer is created outside of a
-Tokio runtime. That is why rt.block_on(sleep(...)) will panic,
-since the function is executed outside of the runtime.
-Whereas rt.block_on(async {sleep(...).await}) doesn’t panic.
-And this is because wrapping the function on an async makes it lazy,
-and so gets executed inside the runtime successfully without
-panicking.
-
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_net_report/time/fn.sleep_until.html b/pr/3139/docs/iroh_net_report/time/fn.sleep_until.html
deleted file mode 100644
index 9222b97106..0000000000
--- a/pr/3139/docs/iroh_net_report/time/fn.sleep_until.html
+++ /dev/null
@@ -1,31 +0,0 @@
-sleep_until in iroh_net_report::time - Rust
No work is performed while awaiting on the sleep future to complete. Sleep
-operates at millisecond granularity and should not be used for tasks that
-require high-resolution timers.
-
To run something regularly on a schedule, see interval.
It can also panic whenever a timer is created outside of a
-Tokio runtime. That is why rt.block_on(sleep(...)) will panic,
-since the function is executed outside of the runtime.
-Whereas rt.block_on(async {sleep(...).await}) doesn’t panic.
-And this is because wrapping the function on an async makes it lazy,
-and so gets executed inside the runtime successfully without
-panicking.
-
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_net_report/time/fn.timeout.html b/pr/3139/docs/iroh_net_report/time/fn.timeout.html
deleted file mode 100644
index dd487b07d6..0000000000
--- a/pr/3139/docs/iroh_net_report/time/fn.timeout.html
+++ /dev/null
@@ -1,47 +0,0 @@
-timeout in iroh_net_report::time - Rust
Requires a Future to complete before the specified duration has elapsed.
-
If the future completes before the duration has elapsed, then the completed
-value is returned. Otherwise, an error is returned and the future is
-canceled.
-
Note that the timeout is checked before polling the future, so if the future
-does not yield during execution then it is possible for the future to complete
-and exceed the timeout without returning an error.
-
This function returns a future whose return type is Result<T,Elapsed>, where T is the
-return type of the provided future.
-
If the provided future completes immediately, then the future returned from
-this function is guaranteed to complete immediately with an Ok variant
-no matter the provided duration.
Create a new Timeout set to expire in 10 milliseconds.
-
-
use tokio::time::timeout;
-use tokio::sync::oneshot;
-
-use std::time::Duration;
-
-let (tx, rx) = oneshot::channel();
-
-// Wrap the future with a `Timeout` set to expire in 10 milliseconds.
-if let Err(_) = timeout(Duration::from_millis(10), rx).await {
- println!("did not receive value within 10 ms");
-}
It can also panic whenever a timer is created outside of a
-Tokio runtime. That is why rt.block_on(sleep(...)) will panic,
-since the function is executed outside of the runtime.
-Whereas rt.block_on(async {sleep(...).await}) doesn’t panic.
-And this is because wrapping the function on an async makes it lazy,
-and so gets executed inside the runtime successfully without
-panicking.
-
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_net_report/time/fn.timeout_at.html b/pr/3139/docs/iroh_net_report/time/fn.timeout_at.html
deleted file mode 100644
index 6715e3aef4..0000000000
--- a/pr/3139/docs/iroh_net_report/time/fn.timeout_at.html
+++ /dev/null
@@ -1,33 +0,0 @@
-timeout_at in iroh_net_report::time - Rust
Requires a Future to complete before the specified instant in time.
-
If the future completes before the instant is reached, then the completed
-value is returned. Otherwise, an error is returned.
-
This function returns a future whose return type is Result<T,Elapsed>, where T is the
-return type of the provided future.
-
If the provided future completes immediately, then the future returned from
-this function is guaranteed to complete immediately with an Ok variant
-no matter the provided deadline.
Create a new Timeout set to expire in 10 milliseconds.
-
-
use tokio::time::{Instant, timeout_at};
-use tokio::sync::oneshot;
-
-use std::time::Duration;
-
-let (tx, rx) = oneshot::channel();
-
-// Wrap the future with a `Timeout` set to expire 10 milliseconds into the
-// future.
-if let Err(_) = timeout_at(Instant::now() + Duration::from_millis(10), rx).await {
- println!("did not receive value within 10 ms");
-}
-
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_net_report/time/index.html b/pr/3139/docs/iroh_net_report/time/index.html
deleted file mode 100644
index f1be6eab09..0000000000
--- a/pr/3139/docs/iroh_net_report/time/index.html
+++ /dev/null
@@ -1,10 +0,0 @@
-iroh_net_report::time - Rust
This type allows you to wait on a sequence of instants with a certain
-duration between each instant. Unlike calling sleep in a loop, this lets
-you count the time spent between the calls to sleep as well.
-
An Interval can be turned into a Stream with IntervalStream.
This method is cancellation safe. If tick is used as the branch in a tokio::select! and
-another branch completes first, then no tick has been consumed.
Polls for the next instant in the interval to be reached.
-
This method can return the following values:
-
-
Poll::Pending if the next instant has not yet been reached.
-
Poll::Ready(instant) if the next instant has been reached.
-
-
When this method returns Poll::Pending, the current task is scheduled
-to receive a wakeup when the instant has elapsed. Note that on multiple
-calls to poll_tick, only the Waker from the
-Context passed to the most recent call is scheduled to receive a
-wakeup.
Sets the next tick to expire at the given instant. If the instant is in
-the past, then the MissedTickBehavior strategy will be used to
-catch up. If the instant is in the future, then the next tick will
-complete at the given instant, even if that means that it will sleep for
-longer than the duration of this Interval. If the Interval had
-any missed ticks before calling this method, then those are discarded.
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_relay/all.html b/pr/3139/docs/iroh_relay/all.html
index 99dfe02ce1..998deffb92 100644
--- a/pr/3139/docs/iroh_relay/all.html
+++ b/pr/3139/docs/iroh_relay/all.html
@@ -1 +1 @@
-List of all items in this crate
An advisory duration that the client should wait before attempting to reconnect.
It might be zero. It exists for the server to smear out the reconnects.
An advisory duration for how long the client should attempt to reconnect
before giving up and proceeding with its normal connection failure logic. The interval
between retries is undefined for now. A server should not send a TryFor duration more
than a few seconds.
Iroh’s relay is a feature within iroh, a peer-to-peer
networking system designed to facilitate direct, encrypted connections between devices. Iroh
aims to simplify decentralized communication by automatically handling connections through
“relays” when direct connections aren’t immediately possible. The relay server helps establish
@@ -26,5 +26,5 @@ STUN support and expose metrics.
Configuration for speaking to the QUIC endpoint on the relay
server to do QUIC address discovery.
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_relay/protos/relay/index.html b/pr/3139/docs/iroh_relay/protos/relay/index.html
index 21388c9425..3d788b4daf 100644
--- a/pr/3139/docs/iroh_relay/protos/relay/index.html
+++ b/pr/3139/docs/iroh_relay/protos/relay/index.html
@@ -1,4 +1,4 @@
-iroh_relay::protos::relay - Rust
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_relay/server/index.html b/pr/3139/docs/iroh_relay/server/index.html
index 8f9c6a2710..a41c86ccb2 100644
--- a/pr/3139/docs/iroh_relay/server/index.html
+++ b/pr/3139/docs/iroh_relay/server/index.html
@@ -1,4 +1,4 @@
-iroh_relay::server - Rust
A fully-fledged iroh-relay server over HTTP or HTTPS.
This module provides an API to run a full fledged iroh-relay server. It is primarily
used by the iroh-relay binary in this crate. It can be used to run a relay server in
other locations however.
diff --git a/pr/3139/docs/iroh_relay/server/struct.ReloadingResolver.html b/pr/3139/docs/iroh_relay/server/struct.ReloadingResolver.html
index d48828fb79..3f4dce0a9c 100644
--- a/pr/3139/docs/iroh_relay/server/struct.ReloadingResolver.html
+++ b/pr/3139/docs/iroh_relay/server/struct.ReloadingResolver.html
@@ -1,6 +1,6 @@
ReloadingResolver in iroh_relay::server - Rust
diff --git a/pr/3139/docs/iroh_relay/sidebar-items.js b/pr/3139/docs/iroh_relay/sidebar-items.js
index 0d25072021..e7e5024d2e 100644
--- a/pr/3139/docs/iroh_relay/sidebar-items.js
+++ b/pr/3139/docs/iroh_relay/sidebar-items.js
@@ -1 +1 @@
-window.SIDEBAR_ITEMS = {"mod":["client","defaults","http","protos","quic","server"],"struct":["PingTracker","RelayMap","RelayNode","RelayQuicConfig"]};
\ No newline at end of file
+window.SIDEBAR_ITEMS = {"mod":["client","defaults","http","protos","quic","server","time"],"struct":["PingTracker","RelayMap","RelayNode","RelayQuicConfig"]};
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_relay/struct.PingTracker.html b/pr/3139/docs/iroh_relay/struct.PingTracker.html
index 7e57efefda..d062dd565b 100644
--- a/pr/3139/docs/iroh_relay/struct.PingTracker.html
+++ b/pr/3139/docs/iroh_relay/struct.PingTracker.html
@@ -1,7 +1,7 @@
PingTracker in iroh_relay - Rust
Only the pong of the most recent ping will do anything. There is no harm feeding
diff --git a/pr/3139/docs/iroh_relay/time/fn.sleep.html b/pr/3139/docs/iroh_relay/time/fn.sleep.html
new file mode 100644
index 0000000000..ac9120f711
--- /dev/null
+++ b/pr/3139/docs/iroh_relay/time/fn.sleep.html
@@ -0,0 +1,36 @@
+
Equivalent to sleep_until(Instant::now() + duration). An asynchronous
+analog to std::thread::sleep.
+
No work is performed while awaiting on the sleep future to complete. Sleep
+operates at millisecond granularity and should not be used for tasks that
+require high-resolution timers. The implementation is platform specific,
+and some platforms (specifically Windows) will provide timers with a
+larger resolution than 1 ms.
+
To run something regularly on a schedule, see interval.
+
The maximum duration for a sleep is 68719476734 milliseconds (approximately 2.2 years).
It can also panic whenever a timer is created outside of a
+Tokio runtime. That is why rt.block_on(sleep(...)) will panic,
+since the function is executed outside of the runtime.
+Whereas rt.block_on(async {sleep(...).await}) doesn’t panic.
+And this is because wrapping the function on an async makes it lazy,
+and so gets executed inside the runtime successfully without
+panicking.
+
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_relay/time/fn.sleep_until.html b/pr/3139/docs/iroh_relay/time/fn.sleep_until.html
new file mode 100644
index 0000000000..d2b6c03be3
--- /dev/null
+++ b/pr/3139/docs/iroh_relay/time/fn.sleep_until.html
@@ -0,0 +1,31 @@
+sleep_until in iroh_relay::time - Rust
No work is performed while awaiting on the sleep future to complete. Sleep
+operates at millisecond granularity and should not be used for tasks that
+require high-resolution timers.
+
To run something regularly on a schedule, see interval.
It can also panic whenever a timer is created outside of a
+Tokio runtime. That is why rt.block_on(sleep(...)) will panic,
+since the function is executed outside of the runtime.
+Whereas rt.block_on(async {sleep(...).await}) doesn’t panic.
+And this is because wrapping the function on an async makes it lazy,
+and so gets executed inside the runtime successfully without
+panicking.
+
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_relay/time/fn.timeout.html b/pr/3139/docs/iroh_relay/time/fn.timeout.html
new file mode 100644
index 0000000000..d793266a87
--- /dev/null
+++ b/pr/3139/docs/iroh_relay/time/fn.timeout.html
@@ -0,0 +1,47 @@
+timeout in iroh_relay::time - Rust
Requires a Future to complete before the specified duration has elapsed.
+
If the future completes before the duration has elapsed, then the completed
+value is returned. Otherwise, an error is returned and the future is
+canceled.
+
Note that the timeout is checked before polling the future, so if the future
+does not yield during execution then it is possible for the future to complete
+and exceed the timeout without returning an error.
+
This function returns a future whose return type is Result<T,Elapsed>, where T is the
+return type of the provided future.
+
If the provided future completes immediately, then the future returned from
+this function is guaranteed to complete immediately with an Ok variant
+no matter the provided duration.
Create a new Timeout set to expire in 10 milliseconds.
+
+
use tokio::time::timeout;
+use tokio::sync::oneshot;
+
+use std::time::Duration;
+
+let (tx, rx) = oneshot::channel();
+
+// Wrap the future with a `Timeout` set to expire in 10 milliseconds.
+if let Err(_) = timeout(Duration::from_millis(10), rx).await {
+ println!("did not receive value within 10 ms");
+}
It can also panic whenever a timer is created outside of a
+Tokio runtime. That is why rt.block_on(sleep(...)) will panic,
+since the function is executed outside of the runtime.
+Whereas rt.block_on(async {sleep(...).await}) doesn’t panic.
+And this is because wrapping the function on an async makes it lazy,
+and so gets executed inside the runtime successfully without
+panicking.
+
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_relay/time/index.html b/pr/3139/docs/iroh_relay/time/index.html
new file mode 100644
index 0000000000..2a819b9b24
--- /dev/null
+++ b/pr/3139/docs/iroh_relay/time/index.html
@@ -0,0 +1,4 @@
+iroh_relay::time - Rust
Requires a Future to complete before the specified duration has elapsed.
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_relay/time/sidebar-items.js b/pr/3139/docs/iroh_relay/time/sidebar-items.js
new file mode 100644
index 0000000000..02ee5a39dc
--- /dev/null
+++ b/pr/3139/docs/iroh_relay/time/sidebar-items.js
@@ -0,0 +1 @@
+window.SIDEBAR_ITEMS = {"fn":["sleep","sleep_until","timeout"],"struct":["Duration","Elapsed","Instant","Sleep","Timeout"]};
\ No newline at end of file
diff --git a/pr/3139/docs/iroh_net_report/time/struct.Duration.html b/pr/3139/docs/iroh_relay/time/struct.Duration.html
similarity index 60%
rename from pr/3139/docs/iroh_net_report/time/struct.Duration.html
rename to pr/3139/docs/iroh_relay/time/struct.Duration.html
index 8f0a73bd3a..12c53588a5 100644
--- a/pr/3139/docs/iroh_net_report/time/struct.Duration.html
+++ b/pr/3139/docs/iroh_relay/time/struct.Duration.html
@@ -1,10 +1,10 @@
-Duration in iroh_net_report::time - Rust
A Duration type to represent a span of time, typically used for system
timeouts.
Each Duration is composed of a whole number of seconds and a fractional part
represented in nanoseconds. If the underlying system does not support
nanosecond-level precision, APIs binding a system timeout will typically round up
the number of nanoseconds.
-
Durations implement many common traits, including Add, Sub, and other
+
Durations implement many common traits, including Add, Sub, and other
ops traits. It implements Default by returning a zero-length Duration.
use std::time::Duration;
@@ -24,38 +24,38 @@ provides a Debug impl that shows the full precision of the value.
program output may appear in contexts that cannot rely on full Unicode
compatibility, you may wish to format Duration objects yourself or use a
crate to do so.
-
May vary by platform as necessary. Must be able to contain the difference between
two instances of Instant or two instances of SystemTime.
This constraint gives it a value of about 584,942,417,355 years in practice,
@@ -64,7 +64,7 @@ which is currently used on all platforms.
use std::time::Duration;
assert_eq!(Duration::MAX, Duration::new(u64::MAX, 1_000_000_000 - 1));
Creates a new Duration from the specified number of nanoseconds.
Note: Using this on the return value of as_nanos() might cause unexpected behavior:
as_nanos() returns a u128, and can return values that do not fit in u64, e.g. 585 years.
Instead, consider using the pattern Duration::new(d.as_secs(), d.subsec_nanos())
@@ -111,7 +111,7 @@ if you cannot copy/clone the Duration directly.
Returns the fractional part of this Duration, in whole milliseconds.
This method does not return the length of the duration when
represented by milliseconds. The returned number always represents a
@@ -225,20 +225,20 @@ fractional portion of a second (i.e., it is less than one billion).
let duration = Duration::new(5, 730_023_852);
assert_eq!(duration.as_nanos(), 5_730_023_852);
use std::time::Duration;
let dur1 = Duration::new(2, 700_000_000);
let dur2 = Duration::new(5, 400_000_000);
assert_eq!(dur1.div_duration_f64(dur2), 0.5);
use std::time::Duration;
let dur1 = Duration::new(2, 700_000_000);
let dur2 = Duration::new(5, 400_000_000);
assert_eq!(dur1.div_duration_f32(dur2), 0.5);
use std::time::Duration;
@@ -460,7 +460,7 @@ as f32.
let val = f32::from_bits(0x3F806000);
let res = Duration::try_from_secs_f32(val);
assert_eq!(res, Ok(Duration::new(1, 2_929_688)));
use std::time::Duration;
@@ -517,46 +517,46 @@ as f32.
let val = f64::from_bits(0x3_FF00_C000_0000_000);
let res = Duration::try_from_secs_f64(val);
assert_eq!(res, Ok(Duration::new(1, 2_929_688)));
where
diff --git a/pr/3139/docs/iroh_net_report/time/error/struct.Elapsed.html b/pr/3139/docs/iroh_relay/time/struct.Elapsed.html
similarity index 58%
rename from pr/3139/docs/iroh_net_report/time/error/struct.Elapsed.html
rename to pr/3139/docs/iroh_relay/time/struct.Elapsed.html
index 86947995d4..007b5dd52b 100644
--- a/pr/3139/docs/iroh_net_report/time/error/struct.Elapsed.html
+++ b/pr/3139/docs/iroh_relay/time/struct.Elapsed.html
@@ -1,8 +1,8 @@
-Elapsed in iroh_net_report::time::error - Rust
A measurement of a monotonically nondecreasing clock.
Opaque and useful only with Duration.
Instants are always guaranteed to be no less than any previously measured
instant when created, and are often useful for tasks such as measuring
@@ -18,16 +18,16 @@ system.
This type wraps the inner std variant and is used to align the Tokio
clock for uses of now(). This can be useful for testing where you can
take advantage of time::pause() and time::advance().
use tokio::time::{Duration, Instant, sleep};
@@ -40,7 +40,7 @@ None if that instant is later than this one.
println!("{:?}", new_now.checked_duration_since(now));
println!("{:?}", now.checked_duration_since(new_now)); // None
}
use tokio::time::{Duration, Instant, sleep};
@@ -53,7 +53,7 @@ zero duration if that instant is later than this one.
println!("{:?}", new_now.saturating_duration_since(now));
println!("{:?}", now.saturating_duration_since(new_now)); // 0ns
}
use tokio::time::{Duration, Instant, sleep};
@@ -65,23 +65,23 @@ or zero duration if this instant is in the future.
sleep(three_secs).await;
assert!(instant.elapsed() >= three_secs);
}
Returns Some(t) where t is the time self + duration if t can be
represented as Instant (which means it’s inside the bounds of the
underlying data structure), None otherwise.
Returns Some(t) where t is the time self - duration if t can be
represented as Instant (which means it’s inside the bounds of the
underlying data structure), None otherwise.