diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index afbd5d58dd..d194892f74 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -964,7 +964,7 @@ impl Endpoint { /// /// Returns an error if closing the magic socket failed. /// TODO: Document error cases. - pub async fn close(self, error_code: VarInt, reason: &[u8]) -> Result<()> { + pub async fn close(&self, error_code: VarInt, reason: &[u8]) -> Result<()> { let Endpoint { msock, endpoint, @@ -975,9 +975,7 @@ impl Endpoint { 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?; diff --git a/iroh-router/src/router.rs b/iroh-router/src/router.rs index 70e4633f43..bd39e9b5b0 100644 --- a/iroh-router/src/router.rs +++ b/iroh-router/src/router.rs @@ -181,9 +181,7 @@ async fn shutdown(endpoint: &Endpoint, protocols: Arc) { // Closing the Endpoint is the equivalent of calling Connection::close on all // connections: Operations will immediately fail with ConnectionError::LocallyClosed. // All streams are interrupted, this is not graceful. - endpoint - .clone() - .close(error_code.into(), b"provider terminating"), + endpoint.close(error_code.into(), b"provider terminating"), // Shutdown protocol handlers. protocols.shutdown(), );