ouroboros-network-framework- Ouroboros network framework
Safe HaskellSafe-Inferred



The implementation of connection manager.



data ConnectionManagerArguments handlerTrace socket peerAddr handle handleError versionNumber versionData m Source #

Arguments for a ConnectionManager which are independent of MuxMode.




withConnectionManager Source #


∷ ∀ (muxMode ∷ MuxMode) peerAddr socket handlerTrace handle handleError version versionData m a. (Alternative (STM m), MonadLabelledSTM m, MonadTraceSTM m, MonadFork m, MonadAsync m, MonadDelay m, MonadEvaluate m, MonadFix m, MonadMask m, MonadThrow (STM m), MonadTimer m, Ord peerAddr, Show peerAddr, Typeable peerAddr) 
ConnectionManagerArguments handlerTrace socket peerAddr handle handleError version versionData m 
ConnectionHandler muxMode handlerTrace socket peerAddr handle handleError (version, versionData) m

Callback which runs in a thread dedicated for a given connection.

→ (handleError → HandleErrorType)

classify handleErrors

InResponderMode muxMode (InformationChannel (NewConnectionInfo peerAddr handle) m)

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 ConnectionManager. It must not leak outside of scope of this callback. Once it returns all resources will be closed.

→ 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.

defaultProtocolIdleTimeoutDiffTime 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.



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 connect call returns.

note: the async handle is lazy, because it's passed with mfix.

OutboundUniState !(ConnectionId peerAddr) !(Async m ()) !handle

OutboundState Unidirectional state.

OutboundDupState !(ConnectionId peerAddr) !(Async m ()) !handle !TimeoutExpired

Either OutboundState Duplex or OutboundState^tau Duplex.

OutboundIdleState !(ConnectionId peerAddr) !(Async m ()) !handle !DataFlow

Before connection is reset it is put in OutboundIdleState for the duration of cmOutboundIdleTimeout.

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 details
(Show peerAddr, Show handleError, MonadAsync m) ⇒ Show (ConnectionState peerAddr handle handleError version m) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionManager.Core


showsPrecIntConnectionState peerAddr handle handleError version m → ShowS #

showConnectionState peerAddr handle handleError version m → String #

showList ∷ [ConnectionState peerAddr handle handleError version m] → ShowS #