Safe Haskell | None |
---|---|
Language | Haskell2010 |
Peers management
Synopsis
- empty :: PeersState
- addKnownPeer :: (HasPeersState env, HasCacheStorage env) => Peer -> UTCTime -> Account -> RIO env ()
- updateKnownPeers :: (HasCacheStorage env, HasPeersState env) => UTCTime -> RIO env ()
- updateLastContact :: MonadIO m => Peer -> UTCTime -> ReaderT SqlBackend m ()
- keepAlivePeriod :: NominalDiffTime
- mkKeepAliveMessages :: (HasCoreConfig env, HasPeersState env) => UTCTime -> Set Peer -> ReaderT env STM [(Peer, MessageBody)]
- periodicKeepAliveMessages :: (HasCoreConfig env, HasNetworkConfig env, HasPeersState env) => UTCTime -> ReaderT env STM [(Peer, MessageBody)]
- trimSentKeepAlives :: HasPeersState env => UTCTime -> ReaderT env STM ()
- peerNodeIdHandshakeQuery :: (HasCryptoConfig env, HasPeersState env) => Peer -> UTCTime -> ReaderT env STM (Maybe Cookie)
- periodicallyCleanupNodeIdHandshakes :: HasPeersState env => RIO env ()
- verifyPeerNodeIdHandshakeCookie :: HasPeersState env => Peer -> Account -> Signature -> RIO env Bool
- module Gini.Network.Types.Peers
Initialization
empty :: PeersState #
Empty peers state
Known peers
addKnownPeer :: (HasPeersState env, HasCacheStorage env) => Peer -> UTCTime -> Account -> RIO env () #
Add (or update) a new known peer
updateKnownPeers :: (HasCacheStorage env, HasPeersState env) => UTCTime -> RIO env () #
Remove peers from database that haven't been heard from in too long and update the in-memory structure.
updateLastContact :: MonadIO m => Peer -> UTCTime -> ReaderT SqlBackend m () #
Update the last time a peer has contacted us.
KeepAlive
keepAlivePeriod :: NominalDiffTime #
How often to send keepalives to a given peer
mkKeepAliveMessages :: (HasCoreConfig env, HasPeersState env) => UTCTime -> Set Peer -> ReaderT env STM [(Peer, MessageBody)] #
Create KeepAlive messages for the given peers. Only peers that have not already recently been sent a KeepAlive will have messages.
periodicKeepAliveMessages :: (HasCoreConfig env, HasNetworkConfig env, HasPeersState env) => UTCTime -> ReaderT env STM [(Peer, MessageBody)] #
trimSentKeepAlives :: HasPeersState env => UTCTime -> ReaderT env STM () #
Remove old records of sent keepalives.
Node ID handshake
peerNodeIdHandshakeQuery :: (HasCryptoConfig env, HasPeersState env) => Peer -> UTCTime -> ReaderT env STM (Maybe Cookie) #
If the received from peer is unknown and there are not already too many in-progress handshakes for the host, returns a node ID query handshake cookie to send to it.
periodicallyCleanupNodeIdHandshakes :: HasPeersState env => RIO env () #
Run background process to clean up pending node ID handshakes
verifyPeerNodeIdHandshakeCookie :: HasPeersState env => Peer -> Account -> Signature -> RIO env Bool #
Verify a peer's node ID handshake response cookie
Types
module Gini.Network.Types.Peers