Skip to content

fix(iroh): Don't cause re-stuns all the time in browsers #3234

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

Merged
merged 2 commits into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
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
15 changes: 10 additions & 5 deletions iroh/src/magicsock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1913,11 +1913,16 @@ impl Handle {
}
})
.await;
if shutdown_done.is_ok() {
warn!("tasks shutdown complete");
// shutdown all tasks
warn!("aborting remaining {}/3 tasks", tasks.len());
tasks.shutdown().await;
match shutdown_done {
Ok(_) => trace!("tasks finished in time, shutdown complete"),
Err(_elapsed) => {
// shutdown all tasks
warn!(
"tasks didn't finish in time, aborting remaining {}/3 tasks",
tasks.len()
);
tasks.shutdown().await;
}
}
trace!("magicsock closed");
}
Expand Down
7 changes: 7 additions & 0 deletions iroh/src/magicsock/node_map/node_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ impl NodeState {
///
/// When a call-me-maybe message is sent we also need to send pings to all known paths
/// of the endpoint. The [`NodeState::send_call_me_maybe`] function takes care of this.
#[cfg(not(wasm_browser))]
#[instrument("want_call_me_maybe", skip_all)]
fn want_call_me_maybe(&self, now: &Instant) -> bool {
trace!("full ping: wanted?");
Expand Down Expand Up @@ -418,6 +419,12 @@ impl NodeState {
}
}

#[cfg(wasm_browser)]
fn want_call_me_maybe(&self, _now: &Instant) -> bool {
trace!("full ping: skipped in browser");
false
}

/// Cleanup the expired ping for the passed in txid.
#[instrument("disco", skip_all, fields(node = %self.node_id.fmt_short()))]
pub(super) fn ping_timeout(&mut self, txid: stun::TransactionId) {
Expand Down
Loading