Skip to content

Commit 8de849c

Browse files
committed
connection manager: propagate disconnection reason to peer selection
Propagate the reason why the connection manager wasn't able to create a connection to peer selection.
1 parent 39e9260 commit 8de849c

File tree

1 file changed

+8
-8
lines changed
  • ouroboros-network-framework/src/Ouroboros/Network/ConnectionManager

1 file changed

+8
-8
lines changed

ouroboros-network-framework/src/Ouroboros/Network/ConnectionManager/Core.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ with args@Arguments {
16411641
-- @
16421642
let connState' = OutboundUniState connId connThread handle
16431643
writeTVar connVar connState'
1644-
return (Just $ mkTransition connState connState')
1644+
return (Right $ mkTransition connState connState')
16451645
Duplex -> do
16461646
-- @
16471647
-- Negotiated^{Duplex}_{Outbound}
@@ -1660,7 +1660,7 @@ with args@Arguments {
16601660
-- `includeInboundConnectionImpl`
16611661
_otherwise -> return ()
16621662

1663-
return (Just $ mkTransition connState connState')
1663+
return (Right $ mkTransition connState connState')
16641664

16651665
-- @
16661666
-- SelfConn'^{-1}
@@ -1670,7 +1670,7 @@ with args@Arguments {
16701670
InboundIdleState connId' connThread' handle' Unidirectional -> do
16711671
let connState' = OutboundUniState connId' connThread' handle'
16721672
writeTVar connVar connState'
1673-
return (Just $ mkTransition connState connState')
1673+
return (Right $ mkTransition connState connState')
16741674

16751675
-- @
16761676
-- SelfConn'^{-1}
@@ -1680,19 +1680,19 @@ with args@Arguments {
16801680
InboundIdleState connId' connThread' handle' Duplex -> do
16811681
let connState' = OutboundDupState connId' connThread' handle' Ticking
16821682
writeTVar connVar connState'
1683-
return (Just $ mkTransition connState connState')
1683+
return (Right $ mkTransition connState connState')
16841684

1685-
TerminatedState _ ->
1686-
return Nothing
1685+
TerminatedState err ->
1686+
return $ Left err
16871687
_ ->
16881688
let st = State.abstractState (Known connState) in
16891689
throwSTM (withCallStack (ForbiddenOperation peerAddr st))
16901690
traverse_ (traceWith trTracer . TransitionTrace connStateId)
16911691
mbTransition
16921692
traceCounters stateVar
16931693
return $ case mbTransition of
1694-
Just _ -> Connected connId dataFlow handle
1695-
Nothing -> Disconnected connId Nothing
1694+
Right _ -> Connected connId dataFlow handle
1695+
Left err -> Disconnected connId err
16961696

16971697
Right (There connId) -> do
16981698
-- We can only enter the 'There' case if there is an inbound

0 commit comments

Comments
 (0)