core: test async handshake (#569)

* core: test async handshake

* Update tests/ChatTests.hs

Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>
This commit is contained in:
Evgeny Poberezkin
2022-04-25 16:30:21 +01:00
committed by GitHub
parent 5fc1364fd3
commit cd2eb9c88e
7 changed files with 105 additions and 17 deletions
+5
View File
@@ -146,6 +146,11 @@ startChatController user = do
atomically . writeTVar s $ Just a
pure a
stopChatController :: MonadUnliftIO m => ChatController -> m ()
stopChatController ChatController {smpAgent, agentAsync = s} = do
disconnectAgentClient smpAgent
readTVarIO s >>= mapM_ uninterruptibleCancel >> atomically (writeTVar s Nothing)
withLock :: MonadUnliftIO m => TMVar () -> m a -> m a
withLock lock =
E.bracket_