From a6ad4f65394c4ae3548ed6091ab9be8c980998e2 Mon Sep 17 00:00:00 2001 From: Ayush7614 Date: Sun, 2 Aug 2026 00:35:22 +0530 Subject: [PATCH] Fix Periphery assign-only findings on QuotaByteReservation. Keep scope and bytes only in the coordination map; the reservation token is an opaque id so the dead-code scan stays clean under --strict. --- bitchat/Services/BLE/BLEIncomingFileStore.swift | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/bitchat/Services/BLE/BLEIncomingFileStore.swift b/bitchat/Services/BLE/BLEIncomingFileStore.swift index 076d8471..97b5f616 100644 --- a/bitchat/Services/BLE/BLEIncomingFileStore.swift +++ b/bitchat/Services/BLE/BLEIncomingFileStore.swift @@ -112,10 +112,10 @@ struct BLEIncomingFileStore: @unchecked Sendable { /// to `enforceQuota`, this stays charged against the quota until /// `releaseQuotaReservation` — so cancel / encode failure / panic must /// release it or later writers see a permanently tighter budget. + /// Scope and byte count live in `PayloadCoordination.byteReservations` + /// keyed by `id`; the token itself is only an opaque handle. struct QuotaByteReservation: Sendable { fileprivate let id: UUID - fileprivate let scope: MediaQuotaScope - fileprivate let bytes: Int64 } private final class PayloadCoordination: @unchecked Sendable { @@ -627,11 +627,7 @@ struct BLEIncomingFileStore: @unchecked Sendable { let clamped = Int64(max(0, bytes)) enforceQuotaLocked(reservingBytes: Int(clamped), scope: scope) - let reservation = QuotaByteReservation( - id: UUID(), - scope: scope, - bytes: clamped - ) + let reservation = QuotaByteReservation(id: UUID()) payloadCoordination.byteReservations[reservation.id] = ( scope: scope, bytes: clamped