mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 04:05:20 +00:00
Fix build errors: make aggregationWindow mutable, fix optional unwrapping, correct function name
This commit is contained in:
@@ -126,7 +126,7 @@ class BluetoothMeshService: NSObject {
|
|||||||
// Message aggregation
|
// Message aggregation
|
||||||
private var pendingMessages: [(message: BitchatPacket, destination: String?)] = []
|
private var pendingMessages: [(message: BitchatPacket, destination: String?)] = []
|
||||||
private var aggregationTimer: Timer?
|
private var aggregationTimer: Timer?
|
||||||
private let aggregationWindow: TimeInterval = 0.1 // 100ms window
|
private var aggregationWindow: TimeInterval = 0.1 // 100ms window
|
||||||
private let maxAggregatedMessages = 5
|
private let maxAggregatedMessages = 5
|
||||||
|
|
||||||
// Optimized Bloom filter for efficient duplicate detection
|
// Optimized Bloom filter for efficient duplicate detection
|
||||||
@@ -2557,7 +2557,7 @@ extension BluetoothMeshService: CBPeripheralManagerDelegate {
|
|||||||
scheduleAdvertisingCycle(interval: powerMode.advertisingInterval)
|
scheduleAdvertisingCycle(interval: powerMode.advertisingInterval)
|
||||||
} else {
|
} else {
|
||||||
// Continuous advertising for performance mode
|
// Continuous advertising for performance mode
|
||||||
startAdvertisingIfNeeded()
|
startAdvertising()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2574,7 +2574,7 @@ extension BluetoothMeshService: CBPeripheralManagerDelegate {
|
|||||||
// Disconnect the least active ones
|
// Disconnect the least active ones
|
||||||
let toDisconnect = sortedPeripherals.dropFirst(keepCount)
|
let toDisconnect = sortedPeripherals.dropFirst(keepCount)
|
||||||
for peripheral in toDisconnect {
|
for peripheral in toDisconnect {
|
||||||
centralManager.cancelPeripheralConnection(peripheral)
|
centralManager?.cancelPeripheralConnection(peripheral)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2583,7 +2583,7 @@ extension BluetoothMeshService: CBPeripheralManagerDelegate {
|
|||||||
|
|
||||||
// Stop advertising
|
// Stop advertising
|
||||||
if isAdvertising {
|
if isAdvertising {
|
||||||
peripheralManager.stopAdvertising()
|
peripheralManager?.stopAdvertising()
|
||||||
isAdvertising = false
|
isAdvertising = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2598,12 +2598,12 @@ extension BluetoothMeshService: CBPeripheralManagerDelegate {
|
|||||||
return // Skip advertising in ultra low power + background
|
return // Skip advertising in ultra low power + background
|
||||||
}
|
}
|
||||||
|
|
||||||
startAdvertisingIfNeeded()
|
startAdvertising()
|
||||||
|
|
||||||
// Stop advertising after a short burst (1 second)
|
// Stop advertising after a short burst (1 second)
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { [weak self] in
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { [weak self] in
|
||||||
if self?.batteryOptimizer.currentPowerMode.advertisingInterval ?? 0 > 0 {
|
if self?.batteryOptimizer.currentPowerMode.advertisingInterval ?? 0 > 0 {
|
||||||
self?.peripheralManager.stopAdvertising()
|
self?.peripheralManager?.stopAdvertising()
|
||||||
self?.isAdvertising = false
|
self?.isAdvertising = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user