Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(iroh-net): Remove incremental state from reportgen actor #2180

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions iroh-net/src/netcheck/reportgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,12 @@ impl Client {
let addr = Addr {
sender: msg_tx.clone(),
};
let incremental = last_report.is_some();
let mut actor = Actor {
msg_tx,
msg_rx,
netcheck: netcheck.clone(),
last_report,
port_mapper,
incremental,
relay_map,
stun_sock4,
stun_sock6,
Expand Down Expand Up @@ -186,8 +184,6 @@ struct Actor {
stun_sock6: Option<Arc<UdpSocket>>,

// Internal state.
/// Whether we're doing an incremental report.
incremental: bool,
/// The report being built.
report: Report,
/// The hairping actor.
Expand Down Expand Up @@ -370,7 +366,7 @@ impl Actor {
let enough_relays = std::cmp::min(self.relay_map.len(), ENOUGH_NODES);
if self.report.relay_latency.len() == enough_relays {
let timeout = self.report.relay_latency.max_latency();
let timeout = match self.incremental {
let timeout = match self.last_report.is_some() {
true => timeout,
false => timeout * 2,
};
Expand Down Expand Up @@ -470,7 +466,7 @@ impl Actor {
// If we're doing a full probe, also check for a captive portal. We
// delay by a bit to wait for UDP STUN to finish, to avoid the probe if
// it's unnecessary.
if !self.incremental {
if self.last_report.is_none() {
// Even if we're doing a non-incremental update, we may want to try our
// preferred relay for captive portal detection.
let preferred_relay = self
Expand Down
Loading