Skip to content

Commit

Permalink
Make Endpoint::close not owning
Browse files Browse the repository at this point in the history
  • Loading branch information
iacore committed Nov 3, 2024
1 parent ab3afef commit 04e69ec
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions iroh-net/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,14 +853,12 @@ impl Endpoint {
endpoint,
cancel_token,
..
} = self;
} = &self;
cancel_token.cancel();
tracing::debug!("Closing connections");
endpoint.close(error_code, reason);
endpoint.wait_idle().await;
// In case this is the last clone of `Endpoint`, dropping the `quinn::Endpoint` will
// make it more likely that the underlying socket is not polled by quinn anymore after this
drop(endpoint);

tracing::debug!("Connections closed");

msock.close().await?;
Expand Down

0 comments on commit 04e69ec

Please sign in to comment.