Clear pending retry resolution on peer disconnect

A private-media policy resolution whose completion is dropped by
transport teardown (BLEService messageQueue deallocation guard) left
its peersResolvingReconnectRetry entry in place, parking every future
reconnect-retry resolution for that peer until panic reset. Disconnect
now removes the entry; retained records survive and the next reconnect
starts a fresh resolution.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jack
2026-07-26 13:24:43 +02:00
co-authored by Claude Opus 4.8
parent d9fc8763de
commit 1157023975
3 changed files with 71 additions and 0 deletions
@@ -965,6 +965,16 @@ final class ChatMediaTransferCoordinator {
)
}
/// A policy resolution's completion can be dropped entirely when the
/// transport tears down mid-flight (BLEService's queue guards on a
/// deallocated self), which would leave the pending entry blocking every
/// future resolution for this peer. Disconnection invalidates the
/// resolution's premise anyway, so drop it; retained records stay and the
/// next reconnect starts a fresh resolution.
func peerDidDisconnect(_ peerID: PeerID) {
peersResolvingReconnectRetry.removeValue(forKey: peerID.toShort())
}
/// Local fragment completion is not proof that the recipient reconstructed
/// the file. Only a remote delivery/read receipt releases retry ownership.
func confirmPrivateMediaDelivery(messageID: String) {