mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-27 04:25:20 +00:00
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:
@@ -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) {
|
||||
|
||||
@@ -1773,6 +1773,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate, SynchronousMessage
|
||||
|
||||
case .peerDisconnected(let peerID):
|
||||
transportEventCoordinator.didDisconnectFromPeerSynchronously(peerID)
|
||||
mediaTransferCoordinator.peerDidDisconnect(peerID)
|
||||
|
||||
case .peerListUpdated(let peers):
|
||||
peerListCoordinator.didUpdatePeerListSynchronously(peers)
|
||||
@@ -1866,6 +1867,9 @@ final class ChatViewModel: ObservableObject, BitchatDelegate, SynchronousMessage
|
||||
|
||||
func didDisconnectFromPeer(_ peerID: PeerID) {
|
||||
transportEventCoordinator.didDisconnectFromPeer(peerID)
|
||||
Task { @MainActor [weak self] in
|
||||
self?.mediaTransferCoordinator.peerDidDisconnect(peerID)
|
||||
}
|
||||
}
|
||||
|
||||
func didUpdatePeerList(_ peers: [PeerID]) {
|
||||
|
||||
Reference in New Issue
Block a user