Safe Haskell | None |
---|---|
Language | Haskell2010 |
Server implementation based on ConnectionManager
Synopsis
- data ServerArguments (muxMode :: MuxMode) socket initiatorCtx peerAddr versionData versionNumber bytes (m :: Type -> Type) a b = ServerArguments {
- serverSockets :: NonEmpty socket
- serverSnocket :: Snocket m socket peerAddr
- serverTracer :: Tracer m (ServerTrace peerAddr)
- serverTrTracer :: Tracer m (RemoteTransitionTrace peerAddr)
- serverInboundGovernorTracer :: Tracer m (InboundGovernorTrace peerAddr)
- serverDebugInboundGovernor :: Tracer m (DebugInboundGovernor peerAddr)
- serverConnectionLimits :: AcceptedConnectionsLimit
- serverConnectionManager :: MuxConnectionManager muxMode socket initiatorCtx (ResponderContext peerAddr) peerAddr versionData versionNumber bytes m a b
- serverInboundIdleTimeout :: Maybe DiffTime
- serverInboundInfoChannel :: InboundGovernorInfoChannel muxMode initiatorCtx peerAddr versionData bytes m a b
- data PublicInboundGovernorState peerAddr versionData = PublicInboundGovernorState {
- inboundDuplexPeers :: !(Map peerAddr versionData)
- remoteStateMap :: Map (ConnectionId peerAddr) RemoteSt
- with :: forall (muxMode :: MuxMode) socket initiatorCtx peerAddr versionData versionNumber m a b x. (Alternative (STM m), MonadAsync m, MonadDelay m, MonadCatch m, MonadEvaluate m, MonadLabelledSTM m, MonadMask m, MonadThrow (STM m), MonadTime m, MonadTimer m, HasResponder muxMode ~ 'True, Ord peerAddr, Show peerAddr) => ServerArguments muxMode socket initiatorCtx peerAddr versionData versionNumber ByteString m a b -> (Async m Void -> m (PublicInboundGovernorState peerAddr versionData) -> m x) -> m x
- data ServerTrace peerAddr
- data AcceptConnectionsPolicyTrace
- data RemoteSt
- type RemoteTransition = Transition' (Maybe RemoteSt)
- type RemoteTransitionTrace peerAddr = TransitionTrace' peerAddr (Maybe RemoteSt)
Documentation
data ServerArguments (muxMode :: MuxMode) socket initiatorCtx peerAddr versionData versionNumber bytes (m :: Type -> Type) a b Source #
Server static configuration.
ServerArguments | |
|
data PublicInboundGovernorState peerAddr versionData Source #
Public inbound governor state.
PublicInboundGovernorState | |
|
Run server
:: forall (muxMode :: MuxMode) socket initiatorCtx peerAddr versionData versionNumber m a b x. (Alternative (STM m), MonadAsync m, MonadDelay m, MonadCatch m, MonadEvaluate m, MonadLabelledSTM m, MonadMask m, MonadThrow (STM m), MonadTime m, MonadTimer m, HasResponder muxMode ~ 'True, Ord peerAddr, Show peerAddr) | |
=> ServerArguments muxMode socket initiatorCtx peerAddr versionData versionNumber ByteString m a b | record which holds all server arguments |
-> (Async m Void -> m (PublicInboundGovernorState peerAddr versionData) -> m x) | a callback which receives a handle to inbound governor thread and can
read Note that as soon as the callback returns, all threads run by the server will be stopped. |
-> m x |
Run the server, which consists of the following components:
- inbound governor, it corresponds to p2p-governor on outbound side
- accept loop(s), one per given ip address. We support up to one ipv4 address and up to one ipv6 address, i.e. an ipv6 enabled node will run two accept loops on listening on different addresses with shared inbound governor.
The server can be run in either of two MuxMode
-es:
The first one is used in data diffusion for Node-To-Node protocol, while the other is useful for running a server for the Node-To-Client protocol.
Trace
data ServerTrace peerAddr Source #
TrAcceptConnection peerAddr | |
TrAcceptError SomeException | |
TrAcceptPolicyTrace AcceptConnectionsPolicyTrace | |
TrServerStarted [peerAddr] | |
TrServerStopped | |
TrServerError SomeException | similar to |
Instances
Show peerAddr => Show (ServerTrace peerAddr) Source # | |
Defined in Ouroboros.Network.Server2 showsPrec :: Int -> ServerTrace peerAddr -> ShowS # show :: ServerTrace peerAddr -> String # showList :: [ServerTrace peerAddr] -> ShowS # |
data AcceptConnectionsPolicyTrace Source #
Trace for the AcceptConnectionsLimit
policy.
ServerTraceAcceptConnectionRateLimiting DiffTime Int | |
ServerTraceAcceptConnectionHardLimit Word32 | |
ServerTraceAcceptConnectionResume Int |
Instances
Remote connection state tracked by inbound protocol governor.
This type is used for tracing.
type RemoteTransition = Transition' (Maybe RemoteSt) Source #
Nothing
represents uninitialised state.
type RemoteTransitionTrace peerAddr = TransitionTrace' peerAddr (Maybe RemoteSt) Source #