diff --git a/quinn/src/endpoint.rs b/quinn/src/endpoint.rs index b958ca74fa..c134231c70 100644 --- a/quinn/src/endpoint.rs +++ b/quinn/src/endpoint.rs @@ -271,8 +271,10 @@ impl Endpoint { if endpoint.connections.is_empty() { break; } + // Construct future while lock is held to avoid race + self.inner.shared.idle.notified() } - self.inner.shared.idle.notified().await; + .await; } } }