Skip to content

Commit f4735c6

Browse files
authored
fix: do not wait_idle on endpoint close (#1753)
## Description In a longer debugging session with @dignifiedquire we found out that `wait_idle` will *always* wait on a close timer for a few 100 ms before actually completing. If application layer protocols always take care of finishing their work (which we do) this is not needed at all. Also the magicsock will very likely stay around long enough to still send out the close frame. This together with #1752 brings the runtime of the `derp_connect_loop` test down from 15s to 4s on my machine! First round is 2-3s (due to bugs in netcheck making it too slow likely) and subsequent round are all >500ms! ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist - [ ] Self-review. - [ ] Documentation updates if relevant. - [ ] Tests if relevant.
1 parent f6c6932 commit f4735c6

1 file changed

Lines changed: 0 additions & 3 deletions

File tree

iroh-net/src/magic_endpoint.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,6 @@ impl MagicEndpoint {
495495
/// TODO: Document error cases.
496496
pub async fn close(&self, error_code: VarInt, reason: &[u8]) -> Result<()> {
497497
self.endpoint.close(error_code, reason);
498-
self.endpoint.wait_idle().await;
499-
// TODO: Now wait-idle on msock!
500498
self.msock.close().await?;
501499
Ok(())
502500
}
@@ -797,7 +795,6 @@ mod tests {
797795
.instrument(error_span!("client", %i));
798796
tokio::task::spawn(fut).await.unwrap();
799797
println!("[client] round {} done in {:?}", i + 1, now.elapsed());
800-
tokio::time::sleep(Duration::from_secs(1)).await;
801798
}
802799
});
803800

0 commit comments

Comments
 (0)