mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 20:45:20 +00:00
fix connection attempt counter tracker
This commit is contained in:
@@ -198,7 +198,8 @@ class BluetoothConnectionTracker(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update connection attempt atomically
|
// Update connection attempt atomically
|
||||||
val attempts = (currentAttempt?.attempts ?: 0) + 1
|
// If the previous attempt window expired, reset backoff to 1; otherwise increment
|
||||||
|
val attempts = if (currentAttempt?.isExpired() == true) 1 else (currentAttempt?.attempts ?: 0) + 1
|
||||||
pendingConnections[deviceAddress] = ConnectionAttempt(attempts)
|
pendingConnections[deviceAddress] = ConnectionAttempt(attempts)
|
||||||
Log.d(TAG, "Tracker: Added pending connection for $deviceAddress (attempts: $attempts)")
|
Log.d(TAG, "Tracker: Added pending connection for $deviceAddress (attempts: $attempts)")
|
||||||
return true
|
return true
|
||||||
@@ -283,7 +284,6 @@ class BluetoothConnectionTracker(
|
|||||||
subscribedDevices.removeAll { it.address == deviceAddress }
|
subscribedDevices.removeAll { it.address == deviceAddress }
|
||||||
addressPeerMap.remove(deviceAddress)
|
addressPeerMap.remove(deviceAddress)
|
||||||
}
|
}
|
||||||
pendingConnections.remove(deviceAddress)
|
|
||||||
firstAnnounceSeen.remove(deviceAddress)
|
firstAnnounceSeen.remove(deviceAddress)
|
||||||
Log.d(TAG, "Cleaned up device connection for $deviceAddress")
|
Log.d(TAG, "Cleaned up device connection for $deviceAddress")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user