Fix compilation error and add peer tracking logs

- Remove reference to undefined wasInserted variable
- Add proper logging after wasInserted is defined
- Track when peers are added vs already present
This commit is contained in:
jack
2025-07-22 16:50:25 +02:00
parent 3d3c711885
commit f7b4fb815b
+4 -2
View File
@@ -1978,7 +1978,7 @@ class BluetoothMeshService: NSObject {
// Check if we've already announced this peer // Check if we've already announced this peer
let isFirstAnnounce = !announcedPeers.contains(senderID) let isFirstAnnounce = !announcedPeers.contains(senderID)
print("📱 Peer announce: \(senderID), isFirstAnnounce: \(isFirstAnnounce), wasInserted: \(wasInserted ?? false)") print("📱 Peer announce: \(senderID), isFirstAnnounce: \(isFirstAnnounce)")
// Clean up stale peer IDs with the same nickname // Clean up stale peer IDs with the same nickname
collectionsQueue.sync(flags: .barrier) { collectionsQueue.sync(flags: .barrier) {
@@ -2103,7 +2103,9 @@ class BluetoothMeshService: NSObject {
return result return result
} }
if wasInserted { if wasInserted {
// Added peer \(senderID) (\(nickname)) to active peers print("📱 Added peer \(senderID) (\(nickname)) to active peers")
} else {
print("📱 Peer \(senderID) already in active peers")
} }
// Show join message only for first announce AND if we actually added the peer // Show join message only for first announce AND if we actually added the peer