From 3fdde7a61fdce747de8592b609c2352441f8f7d0 Mon Sep 17 00:00:00 2001 From: Rohan Bose Date: Mon, 6 Nov 2023 11:14:39 +0100 Subject: [PATCH] Removed assert to check finalize is called before drop --- quinn-proto/src/connection/streams/recv.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/quinn-proto/src/connection/streams/recv.rs b/quinn-proto/src/connection/streams/recv.rs index 627666b83..d4a6d2c4d 100644 --- a/quinn-proto/src/connection/streams/recv.rs +++ b/quinn-proto/src/connection/streams/recv.rs @@ -281,15 +281,12 @@ impl<'a> Chunks<'a> { /// Finalize pub fn finalize(mut self) -> ShouldTransmit { - self.finalize_inner(false) + self.finalize_inner() } - fn finalize_inner(&mut self, drop: bool) -> ShouldTransmit { + fn finalize_inner(&mut self) -> ShouldTransmit { let state = mem::replace(&mut self.state, ChunksState::Finalized); - debug_assert!( - !drop || matches!(state, ChunksState::Finalized), - "finalize must be called before drop" - ); + if let ChunksState::Finalized = state { // Noop on repeated calls return ShouldTransmit(false); @@ -326,7 +323,7 @@ impl<'a> Chunks<'a> { impl<'a> Drop for Chunks<'a> { fn drop(&mut self) { - let _ = self.finalize_inner(true); + let _ = self.finalize_inner(); } }