ouroboros-network-framework
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.ConnectionManager.Core

Description

The implementation of connection manager.

The module should be imported qualified.

Synopsis

Documentation

data Arguments handlerTrace socket peerAddr handle handleError versionNumber versionData (m :: Type -> Type) Source #

Arguments for a ConnectionManager which are independent of MuxMode.

Constructors

Arguments 

Fields

data Trace peerAddr handlerTrace Source #

ConnectionManagerTrace contains a hole for a trace of single connection which is filled with ConnectionHandlerTrace.

Constructors

TrIncludeConnection Provenance peerAddr 
TrReleaseConnection Provenance (ConnectionId peerAddr) 
TrConnect 

Fields

TrConnectError 

Fields

TrTerminatingConnection Provenance (ConnectionId peerAddr) 
TrTerminatedConnection Provenance peerAddr 
TrConnectionHandler (ConnectionId peerAddr) handlerTrace 
TrShutdown 
TrConnectionExists Provenance peerAddr AbstractState 
TrForbiddenConnection (ConnectionId peerAddr) 
TrConnectionFailure (ConnectionId peerAddr) 
TrConnectionNotFound Provenance peerAddr 
TrForbiddenOperation peerAddr AbstractState 
TrPruneConnections 

Fields

TrConnectionCleanup (ConnectionId peerAddr) 
TrConnectionTimeWait (ConnectionId peerAddr) 
TrConnectionTimeWaitDone (ConnectionId peerAddr) 
TrConnectionManagerCounters ConnectionManagerCounters 
TrState (ConnMap peerAddr AbstractState)

traced on SIGUSR1 signal, installed in runDataDiffusion

TrUnexpectedlyFalseAssertion (AssertionLocation peerAddr)

This case is unexpected at call site.

Instances

Instances details
(Show handlerTrace, Show peerAddr) => Show (Trace peerAddr handlerTrace) Source # 
Instance details

Defined in Ouroboros.Network.ConnectionManager.Core

Methods

showsPrec :: Int -> Trace peerAddr handlerTrace -> ShowS #

show :: Trace peerAddr handlerTrace -> String #

showList :: [Trace peerAddr handlerTrace] -> ShowS #

with Source #

Arguments

:: forall (muxMode :: Mode) 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) 
=> Arguments 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.

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 :: Type -> Type) 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 OutboundState^tau Duplex.

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

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

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

Defined in Ouroboros.Network.ConnectionManager.State

Methods

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

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

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

abstractState :: forall muxMode peerAddr m a (b :: Type -> Type). MaybeUnknown (ConnectionState muxMode peerAddr m a b) -> AbstractState Source #