From 37625fe2d8104466ba8dd6743bab88daa65b1ed1 Mon Sep 17 00:00:00 2001 From: Damien Deville Date: Thu, 16 Apr 2026 14:32:29 +0200 Subject: [PATCH] quinn: fix ref count logic for ConnectionRef and EndpointRef --- quinn/src/connection.rs | 2 +- quinn/src/endpoint.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/quinn/src/connection.rs b/quinn/src/connection.rs index 43ef2f8d2..cf38a1f13 100644 --- a/quinn/src/connection.rs +++ b/quinn/src/connection.rs @@ -932,7 +932,7 @@ impl Clone for ConnectionRef { impl Drop for ConnectionRef { fn drop(&mut self) { - if self.shared.ref_count.fetch_sub(1, Ordering::Relaxed) > 0 { + if self.shared.ref_count.fetch_sub(1, Ordering::Relaxed) > 1 { return; } diff --git a/quinn/src/endpoint.rs b/quinn/src/endpoint.rs index f0fff2cb5..6bb7a5951 100644 --- a/quinn/src/endpoint.rs +++ b/quinn/src/endpoint.rs @@ -784,7 +784,7 @@ impl Clone for EndpointRef { impl Drop for EndpointRef { fn drop(&mut self) { - if self.shared.ref_count.fetch_sub(1, Ordering::Relaxed) > 0 { + if self.shared.ref_count.fetch_sub(1, Ordering::Relaxed) > 1 { return; }