Skip to content

Commit

Permalink
network-mux: removed MuxCleanShutdown
Browse files Browse the repository at this point in the history
It is not a clean shutdown if mux stops while any mini-protocol is still
runing.
  • Loading branch information
coot committed May 8, 2021
1 parent a6463e3 commit a1fb2ad
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions network-mux/src/Network/Mux.hs
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,9 @@ runMiniProtocol Mux { muxMiniProtocols, muxControlCmdQueue , muxStatus}
case st of
MuxReady -> readTMVar completionVar
MuxStopping -> readTMVar completionVar
<|> return (Left $ toException (MuxError MuxCleanShutdown "Mux stopped"))
<|> return (Left $ toException (MuxError (MuxShutdown Nothing) "Mux stoping"))
MuxStopped -> readTMVar completionVar
<|> return (Left $ toException (MuxError MuxCleanShutdown "Mux stopped"))
<|> return (Left $ toException (MuxError (MuxShutdown Nothing) "Mux stopped"))
MuxFailed e -> readTMVar completionVar
<|> return (Left $ toException $
case fromException e of
Expand Down
6 changes: 3 additions & 3 deletions network-mux/src/Network/Mux/Trace.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ data MuxErrorType = MuxUnknownMiniProtocol
| MuxSDUWriteTimeout
-- ^ thrown when writing a single SDU takes too long
| MuxShutdown !(Maybe MuxErrorType)
-- ^ Result of runMiniProtocol's completionAction in case of an error.
| MuxCleanShutdown
-- ^ Mux stopped by 'stopMux'
-- ^ Result of runMiniProtocol's completionAction in case of
-- an error or mux being closed while a mini-protocol was
-- still running, this is not a clean exit.
| MuxBlockedOnCompletionVar !MiniProtocolNum
-- ^ Mux blocked on @completionVar@.
deriving (Show, Eq)
Expand Down
1 change: 0 additions & 1 deletion ouroboros-network/src/Ouroboros/Network/NodeToClient.hs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ networkErrorPolicies = ErrorPolicies
MuxIngressQueueOverRun -> Just ourBug
MuxInitiatorOnly -> Just ourBug
MuxShutdown {} -> Just ourBug
MuxCleanShutdown -> Just ourBug
MuxBlockedOnCompletionVar {} -> Just ourBug

-- in case of bearer closed / or IOException we suspend
Expand Down
1 change: 0 additions & 1 deletion ouroboros-network/src/Ouroboros/Network/NodeToNode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ remoteNetworkErrorPolicy = ErrorPolicies {
MuxSDUReadTimeout -> Just (SuspendPeer shortDelay shortDelay)
MuxSDUWriteTimeout -> Just (SuspendPeer shortDelay shortDelay)
MuxShutdown {} -> Just (SuspendPeer shortDelay shortDelay)
MuxCleanShutdown -> Just (SuspendPeer shortDelay shortDelay)
MuxBlockedOnCompletionVar {} -> Just (SuspendPeer shortDelay shortDelay)

-- Error policy for TxSubmission protocol: outbound side (client role)
Expand Down

0 comments on commit a1fb2ad

Please sign in to comment.