Skip to content

Commit

Permalink
connection-manager & server-test: code style
Browse files Browse the repository at this point in the history
  • Loading branch information
coot committed Oct 27, 2021
1 parent 9751731 commit aa10916
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
Expand Up @@ -802,8 +802,11 @@ connectionManagerErrorFromException x = do
data ConnectionManagerTrace peerAddr handlerTrace
= TrIncludeConnection !Provenance !peerAddr
| TrUnregisterConnection !Provenance !peerAddr
| TrConnect !(Maybe peerAddr) !peerAddr
| TrConnectError !(Maybe peerAddr) !peerAddr !SomeException
| TrConnect !(Maybe peerAddr) -- ^ local address
!peerAddr -- ^ remote address
| TrConnectError !(Maybe peerAddr) -- ^ local address
!peerAddr -- ^ remote address
!SomeException
| TrTerminatingConnection !Provenance !(ConnectionId peerAddr)
| TrTerminatedConnection !Provenance !peerAddr
| TrConnectionHandler !(ConnectionId peerAddr) !handlerTrace
Expand Down
Expand Up @@ -985,7 +985,7 @@ prop_bidirectional_Sim :: NonFailingBearerInfoScript -> ClientAndServerData Int
prop_bidirectional_Sim (NonFailingBearerInfoScript script) data0 data1 =
simulatedPropertyWithTimeout 7200 $
withSnocket sayTracer
script'
(toBearerInfo <$> script)
$ \snock ->
bracket ((,) <$> Snocket.open snock Snocket.TestFamily
<*> Snocket.open snock Snocket.TestFamily)
Expand All @@ -1002,8 +1002,6 @@ prop_bidirectional_Sim (NonFailingBearerInfoScript script) data0 data1 =
socket0 socket1
addr0 addr1
data0 data1
where
script' = toBearerInfo <$> script

prop_bidirectional_IO
:: ClientAndServerData Int
Expand Down
Expand Up @@ -20,6 +20,7 @@ module Test.Simulation.Network.Snocket
, AbsSpeed (..)
, AbsSDUSize (..)
, AbsAttenuation (..)
, absNoAttenuation
, AbsBearerInfo (..)
, toBearerInfo
) where
Expand Down Expand Up @@ -469,6 +470,16 @@ data AbsBearerInfo = AbsBearerInfo
}
deriving (Eq, Show)

absNoAttenuation :: AbsBearerInfo
absNoAttenuation = AbsBearerInfo
{ abiConnectionDelay = NormalDelay
, abiInboundAttenuation = NoAttenuation NormalSpeed
, abiOutboundAttenuation = NoAttenuation NormalSpeed
, abiInboundWriteFailure = Nothing
, abiOutboundWriteFailure = Nothing
, abiSDUSize = NormalSDU
}

canFail :: AbsBearerInfo -> Bool
canFail abi = getAny $
case abiInboundAttenuation abi of
Expand Down

0 comments on commit aa10916

Please sign in to comment.