mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 23:25:20 +00:00
Add type-aware REQUEST_SYNC sync rounds (#853)
Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
@@ -2803,6 +2803,9 @@ extension BLEService {
|
||||
let isActive = self.collectionsQueue.sync { self.activeTransfers[transferId] != nil }
|
||||
guard isActive else { return }
|
||||
}
|
||||
if fragmentRecipient == nil || fragmentRecipient?.allSatisfy({ $0 == 0xFF }) == true {
|
||||
self.gossipSyncManager?.onPublicPacketSeen(fragmentPacket)
|
||||
}
|
||||
self.broadcastPacket(fragmentPacket)
|
||||
if let transferId = transferIdentifier {
|
||||
self.markFragmentSent(transferId: transferId)
|
||||
@@ -2904,6 +2907,14 @@ extension BLEService {
|
||||
// Sanity checks - add reasonable upper bound on total to prevent DoS
|
||||
guard total > 0 && total <= 10000 && index >= 0 && index < total else { return }
|
||||
|
||||
let isBroadcastFragment: Bool = {
|
||||
guard let recipient = packet.recipientID else { return true }
|
||||
return recipient.count == 8 && recipient.allSatisfy { $0 == 0xFF }
|
||||
}()
|
||||
if isBroadcastFragment {
|
||||
gossipSyncManager?.onPublicPacketSeen(packet)
|
||||
}
|
||||
|
||||
// Compute fragment key for this assembly
|
||||
let key = FragmentKey(sender: senderU64, id: fragU64)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user