diff --git a/Sources/SwiftNetwork/Protocols/FrameArray.swift b/Sources/SwiftNetwork/Protocols/FrameArray.swift index 5bbb353..90e59cd 100644 --- a/Sources/SwiftNetwork/Protocols/FrameArray.swift +++ b/Sources/SwiftNetwork/Protocols/FrameArray.swift @@ -36,7 +36,7 @@ public struct FrameArray: ~Copyable { } public init() { - self.frames = NetworkUniqueDeque(minimumCapacity: 1) + self.frames = NetworkUniqueDeque() } public init(capacity: Int) { diff --git a/Sources/SwiftNetwork/QUIC/QUICConnection.swift b/Sources/SwiftNetwork/QUIC/QUICConnection.swift index 8ff817c..557315d 100644 --- a/Sources/SwiftNetwork/QUIC/QUICConnection.swift +++ b/Sources/SwiftNetwork/QUIC/QUICConnection.swift @@ -3196,11 +3196,14 @@ public final class QUICConnection: ManyToManyApplicationStreamProtocol, else { return false } - var datagramBatch = FrameArray() + + var datagramBatch: FrameArray if self.flowControlState.pendingOutboundBytesToSend > 0 && availableCongestionWindow > 0 { datagramBatch = buildOutboundFrameBatch( availableCongestionWindow: (availableCongestionWindow - totalSendBytes) ) + } else { + datagramBatch = FrameArray() } // Sending on the current path.