mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-24 23:25:19 +00:00
fix: sync notification peer count with sidebar
This commit is contained in:
@@ -299,8 +299,7 @@ class PeerManager {
|
|||||||
*/
|
*/
|
||||||
fun isPeerActive(peerID: String): Boolean {
|
fun isPeerActive(peerID: String): Boolean {
|
||||||
val info = peers[peerID] ?: return false
|
val info = peers[peerID] ?: return false
|
||||||
val now = System.currentTimeMillis()
|
return info.isConnected
|
||||||
return (now - info.lastSeen) <= stalePeerTimeoutMs && info.isConnected
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -328,8 +327,7 @@ class PeerManager {
|
|||||||
* Get list of active peer IDs
|
* Get list of active peer IDs
|
||||||
*/
|
*/
|
||||||
fun getActivePeerIDs(): List<String> {
|
fun getActivePeerIDs(): List<String> {
|
||||||
val now = System.currentTimeMillis()
|
return peers.filterValues { it.isConnected }
|
||||||
return peers.filterValues { (now - it.lastSeen) <= stalePeerTimeoutMs && it.isConnected }
|
|
||||||
.keys
|
.keys
|
||||||
.toList()
|
.toList()
|
||||||
.sorted()
|
.sorted()
|
||||||
|
|||||||
Reference in New Issue
Block a user