Skip to content

Commit

Permalink
Use n0_future and remove task module in favor for it
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus23 committed Jan 24, 2025
1 parent e3f81c6 commit 766164e
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 337 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions iroh-net-report/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ futures-lite = "2.3"
iroh-base = { version = "0.31.0", path = "../iroh-base", default-features = false, features = ["relay"] }
iroh-metrics = { version = "0.31", default-features = false }
iroh-relay = { version = "0.31", path = "../iroh-relay", default-features = false }
n0-future = "0.0.1"
quinn = { package = "iroh-quinn", version = "0.12.0", default-features = false }
rand = "0.8"
reqwest = { version = "0.12", default-features = false, features = ["stream"] }
Expand Down
2 changes: 1 addition & 1 deletion iroh-net-report/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/// Contains all timeouts that we use in `iroh-net-report`.
pub(crate) mod timeouts {
use iroh_relay::time::Duration;
use n0_future::time::Duration;

// Timeouts for net_report

Expand Down
2 changes: 1 addition & 1 deletion iroh-net-report/src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{fmt::Write, net::IpAddr};
use anyhow::Result;
use futures_lite::{Future, StreamExt};
use hickory_resolver::{IntoName, TokioResolver};
use iroh_relay::time;
use n0_future::time;

use crate::defaults::timeouts::DNS_TIMEOUT;

Expand Down
9 changes: 3 additions & 6 deletions iroh-net-report/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@ use std::{
sync::Arc,
};

use crate::task::AbortOnDropHandle;
use anyhow::{anyhow, Result};
use bytes::Bytes;
#[cfg(not(wasm_browser))]
use hickory_resolver::TokioResolver as DnsResolver;
use iroh_base::RelayUrl;
#[cfg(feature = "metrics")]
use iroh_metrics::inc;
use iroh_relay::{
protos::stun,
use iroh_relay::{protos::stun, RelayMap};
use n0_future::{
task::{self, AbortOnDropHandle},
time::{self, Duration, Instant},
RelayMap,
};
#[cfg(not(wasm_browser))]
use netwatch::UdpSocket;
Expand All @@ -42,8 +41,6 @@ mod metrics;
mod ping;
mod reportgen;

pub mod task;

pub use metrics::Metrics;
use reportgen::ProbeProto;
pub use reportgen::QuicConfig;
Expand Down
2 changes: 1 addition & 1 deletion iroh-net-report/src/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
};

use anyhow::{Context, Result};
use iroh_relay::time::Duration;
use n0_future::time::Duration;
use surge_ping::{Client, Config, IcmpPacket, PingIdentifier, PingSequence, ICMP};
use tracing::debug;

Expand Down
6 changes: 4 additions & 2 deletions iroh-net-report/src/reportgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use std::{
task::{Context, Poll},
};

use crate::task::{self, AbortOnDropHandle, JoinSet};
use anyhow::{anyhow, bail, Context as _, Result};
use futures_lite::StreamExt as _;
#[cfg(not(wasm_browser))]
Expand All @@ -37,9 +36,12 @@ use iroh_relay::{
defaults::{DEFAULT_RELAY_QUIC_PORT, DEFAULT_STUN_PORT},
http::RELAY_PROBE_PATH,
protos::stun,
time::{self, Duration, Instant},
RelayMap, RelayNode,
};
use n0_future::{
task::{self, AbortOnDropHandle, JoinSet},
time::{self, Duration, Instant},
};
#[cfg(not(wasm_browser))]
use netwatch::{interfaces, UdpSocket};
use rand::seq::IteratorRandom;
Expand Down
5 changes: 3 additions & 2 deletions iroh-net-report/src/reportgen/hairpin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};

use anyhow::{bail, Context, Result};
use iroh_relay::protos::stun;
use n0_future::task;
use netwatch::UdpSocket;
use tokio::sync::oneshot;
use tokio_util::task::AbortOnDropHandle;
Expand All @@ -24,7 +25,7 @@ use tracing::{debug, error, info_span, trace, warn, Instrument};
use crate::{
self as net_report,
defaults::timeouts::HAIRPIN_CHECK_TIMEOUT,
reportgen, task,
reportgen,
time::{self, Instant},
Inflight,
};
Expand Down Expand Up @@ -180,7 +181,7 @@ impl Actor {
#[cfg(test)]
mod tests {
use bytes::BytesMut;
use iroh_relay::time::Duration;
use n0_future::time::Duration;
use tokio::sync::mpsc;
use tracing::info;

Expand Down
2 changes: 1 addition & 1 deletion iroh-net-report/src/reportgen/probes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use std::{collections::BTreeSet, fmt, sync::Arc};
use anyhow::{ensure, Result};
use iroh_base::RelayUrl;
use iroh_relay::{RelayMap, RelayNode};
use n0_future::time::Duration;
#[cfg(not(wasm_browser))]
use netwatch::interfaces;

use crate::Report;
use iroh_relay::time::Duration;

/// The retransmit interval used when net_report first runs.
///
Expand Down
Loading

0 comments on commit 766164e

Please sign in to comment.