ouroboros-network-framework-0.1.0.1
Safe Haskell None
Language Haskell2010

Ouroboros.Network.ConnectionManager.Core

Description

The implementation of connection manager.

Synopsis

Documentation

data ConnectionManagerArguments handlerTrace socket peerAddr handle handleError version m Source #

Arguments for a ConnectionManager which are independent of MuxMode .

Constructors

ConnectionManagerArguments

Fields

withConnectionManager Source #

Arguments

:: 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 handleError s

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

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.

Constructors

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 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 OutobundState^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

Instances details
( Show peerAddr, Show handleError, Show ( ThreadId m), MonadAsync m) => Show ( ConnectionState peerAddr handle handleError version m) Source #
Instance details

Defined in Ouroboros.Network.ConnectionManager.Core

Methods

showsPrec :: Int -> ConnectionState peerAddr handle handleError version m -> ShowS Source #

show :: ConnectionState peerAddr handle handleError version m -> String Source #

showList :: [ ConnectionState peerAddr handle handleError version m] -> ShowS Source #