getPeerStatus method

bool getPeerStatus(
  1. PeerId peerId
)
inherited

Returns the status of a peer.

This method checks if a peer is considered online based on the last time it was seen and the configured peerOnlineTimeout.

peerId The ID of the peer to check.

Returns true if the peer is online, false otherwise.

Implementation

bool getPeerStatus(PeerId peerId) =>
    (routes[peerId]?.lastSeen ?? 0) + peerOnlineTimeout.inMilliseconds >
    _now;