Skip to content

Commit

Permalink
block-fetch tests: fixed termination tests
Browse files Browse the repository at this point in the history
The first assertion of `fetchDecisionsForStateSnapshot` was triggered.
We need first kill the fetch thread before the client side terminates.
  • Loading branch information
coot committed May 23, 2022
1 parent a1ddc56 commit becae51
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ouroboros-network/test/Ouroboros/Network/BlockFetch/Examples.hs
Expand Up @@ -103,11 +103,14 @@ blockFetchExample0 decisionTracer clientStateTracer clientMsgTracer
labelThread threadId "driver"
driver blockHeap

-- Order of shutdown here is important for this example: must kill off the
-- fetch thread before the peer threads.
_ <- waitAnyCancel $ [ fetchAsync, driverAsync,
clientAsync, serverAsync,
syncClientAsync, keepAliveAsync]
-- Order of shutdown is important for this example: must kill the fetch
-- thread before the peer threads, or otherwise the first assertion in
-- `fetchDecisionsForStateSnapshot` can be triggered.
atomically $ controlMessageSTM >>= check . (Terminate ==)
cancel fetchAsync
_ <- waitAnyCancel [ driverAsync, clientAsync, serverAsync
, syncClientAsync, keepAliveAsync
]
return ()

where
Expand Down

0 comments on commit becae51

Please sign in to comment.