fix: sync notification peer count with sidebar

This commit is contained in:
callebtc
2026-01-04 18:49:33 +07:00
parent c663e8ede0
commit f66be359d6
@@ -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()