Safe Haskell | None |
---|---|
Language | Haskell2010 |
The implementation of connection manager.
Synopsis
-
data
ConnectionManagerArguments
handlerTrace socket peerAddr handle handleError version m =
ConnectionManagerArguments
{
- cmTracer :: Tracer m ( ConnectionManagerTrace peerAddr handlerTrace)
- cmTrTracer :: Tracer m ( TransitionTrace peerAddr ( ConnectionState peerAddr handle handleError version m))
- cmMuxTracer :: Tracer m ( WithMuxBearer ( ConnectionId peerAddr) MuxTrace )
- cmIPv4Address :: Maybe peerAddr
- cmIPv6Address :: Maybe peerAddr
- cmAddressType :: peerAddr -> Maybe AddressType
- cmSnocket :: Snocket m socket peerAddr
- cmTimeWaitTimeout :: DiffTime
- cmOutboundIdleTimeout :: DiffTime
- connectionDataFlow :: version -> DataFlow
- cmPrunePolicy :: PrunePolicy peerAddr ( STM m)
- cmConnectionsLimits :: AcceptedConnectionsLimit
- withConnectionManager :: forall (muxMode :: MuxMode ) peerAddr socket handlerTrace handle handleError version m a. ( Monad m, MonadLabelledSTM m, MonadTraceSTM m, MonadFork m, MonadAsync m, MonadEvaluate m, MonadFix m, MonadMask m, MonadMonotonicTime m, MonadThrow ( STM m), MonadTimer m, Ord peerAddr, Show peerAddr, Typeable peerAddr) => ConnectionManagerArguments handlerTrace socket peerAddr handle handleError version m -> ConnectionHandler muxMode handlerTrace socket peerAddr handle handleError version m -> (handleError -> HandleErrorType ) -> InResponderMode muxMode ( ControlChannel m ( NewConnection peerAddr handle)) -> ( ConnectionManager muxMode socket peerAddr handle handleError m -> m a) -> m a
- defaultTimeWaitTimeout :: DiffTime
- defaultProtocolIdleTimeout :: DiffTime
- defaultResetTimeout :: DiffTime
-
data
ConnectionState
peerAddr handle handleError version m
- = ReservedOutboundState
- | UnnegotiatedState ! Provenance !( ConnectionId peerAddr) ( Async m ())
- | OutboundUniState !( ConnectionId peerAddr) !( Async m ()) !handle
- | OutboundDupState !( ConnectionId peerAddr) !( Async m ()) !handle ! TimeoutExpired
- | OutboundIdleState !( ConnectionId peerAddr) !( Async m ()) !handle ! DataFlow
- | InboundIdleState !( ConnectionId peerAddr) !( Async m ()) !handle ! DataFlow
- | InboundState !( ConnectionId peerAddr) !( Async m ()) !handle ! DataFlow
- | DuplexState !( ConnectionId peerAddr) !( Async m ()) !handle
- | TerminatingState !( ConnectionId peerAddr) !( Async m ()) !( Maybe handleError)
- | TerminatedState !( Maybe handleError)
- abstractState :: MaybeUnknown ( ConnectionState muxMode peerAddr m a b) -> AbstractState
Documentation
data ConnectionManagerArguments handlerTrace socket peerAddr handle handleError version m Source #
Arguments for a
ConnectionManager
which are independent of
MuxMode
.
ConnectionManagerArguments | |
|
withConnectionManager Source #
:: forall (muxMode :: MuxMode ) peerAddr socket handlerTrace handle handleError version m a. ( Monad m, MonadLabelledSTM m, MonadTraceSTM m, MonadFork m, MonadAsync m, MonadEvaluate m, MonadFix m, MonadMask m, MonadMonotonicTime m, MonadThrow ( STM m), MonadTimer m, Ord peerAddr, Show peerAddr, Typeable peerAddr) | |
=> ConnectionManagerArguments handlerTrace socket peerAddr handle handleError version m | |
-> ConnectionHandler muxMode handlerTrace socket peerAddr handle handleError version m |
Callback which runs in a thread dedicated for a given connection. |
-> (handleError -> HandleErrorType ) |
classify
|
-> InResponderMode muxMode ( ControlChannel m ( NewConnection peerAddr handle)) |
On outbound duplex connections we need to notify the server about a new connection. |
-> ( ConnectionManager muxMode socket peerAddr handle handleError m -> m a) |
Continuation which receives the
|
-> m a |
Entry point for using the connection manager. This is a classic
with
style
combinator, which cleans resources on exit of the callback (whether cleanly
or through an exception).
Including a connection (either inbound or outbound) is an idempotent operation on connection manager state. The connection manager will always return the handle that was first to be included in its state.
Once an inbound connection is passed to the
ConnectionManager
, the manager
is responsible for the resource.
defaultTimeWaitTimeout :: DiffTime Source #
The default value for
cmTimeWaitTimeout
.
defaultProtocolIdleTimeout :: DiffTime Source #
Inactivity timeout. It configures how long to wait since the local side demoted remote peer to cold , before closing the connection.
data ConnectionState peerAddr handle handleError version m Source #
State of a connection.
ReservedOutboundState |
Each outbound connections starts in this state. |
UnnegotiatedState ! Provenance !( ConnectionId peerAddr) ( Async m ()) |
Each inbound connection starts in this state, outbound connection
reach this state once
note: the async handle is lazy, because it's passed with
|
OutboundUniState !( ConnectionId peerAddr) !( Async m ()) !handle |
|
OutboundDupState !( ConnectionId peerAddr) !( Async m ()) !handle ! TimeoutExpired |
Either
|
OutboundIdleState !( ConnectionId peerAddr) !( Async m ()) !handle ! DataFlow |
Before connection is reset it is put in
|
InboundIdleState !( ConnectionId peerAddr) !( Async m ()) !handle ! DataFlow | |
InboundState !( ConnectionId peerAddr) !( Async m ()) !handle ! DataFlow | |
DuplexState !( ConnectionId peerAddr) !( Async m ()) !handle | |
TerminatingState !( ConnectionId peerAddr) !( Async m ()) !( Maybe handleError) | |
TerminatedState !( Maybe handleError) |
Instances
( Show peerAddr, Show handleError, Show ( ThreadId m), MonadAsync m) => Show ( ConnectionState peerAddr handle handleError version m) Source # | |
Defined in Ouroboros.Network.ConnectionManager.Core |
abstractState :: MaybeUnknown ( ConnectionState muxMode peerAddr m a b) -> AbstractState Source #