mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
core: update simplexmq (connection-level locks) (#1170)
* core: update simplexmq (connection-level locks) * update simplexmq * update simplexmq * update simplexmq * only run file tests * update simplexmq * enable all tests * update simplexmq
This commit is contained in:
committed by
GitHub
parent
f9c691cab1
commit
7a54351f15
+3
-7
@@ -993,9 +993,7 @@ processChatCommand = \case
|
||||
QuitChat -> liftIO exitSuccess
|
||||
ShowVersion -> pure $ CRVersionInfo versionNumber
|
||||
where
|
||||
withChatLock action = do
|
||||
ChatController {chatLock = l, smpAgent = a} <- ask
|
||||
withAgentLock a . withLock l $ action
|
||||
withChatLock action = asks chatLock >>= (`withLock` action)
|
||||
-- below code would make command responses asynchronous where they can be slow
|
||||
-- in View.hs `r'` should be defined as `id` in this case
|
||||
-- procCmd :: m ChatResponse -> m ChatResponse
|
||||
@@ -1377,10 +1375,8 @@ subscribeUserConnections agentBatchSubscribe user = do
|
||||
void . forkIO $ do
|
||||
threadDelay 1000000
|
||||
l <- asks chatLock
|
||||
a <- asks smpAgent
|
||||
when (fileStatus == FSConnected) . unlessM (isFileActive fileId sndFiles) $
|
||||
withAgentLock a . withLock l $
|
||||
sendFileChunk user ft
|
||||
when (fileStatus == FSConnected) . unlessM (isFileActive fileId sndFiles) . withLock l $
|
||||
sendFileChunk user ft
|
||||
rcvFileSubsToView :: Map ConnId (Either AgentErrorType ()) -> Map ConnId RcvFileTransfer -> m ()
|
||||
rcvFileSubsToView rs = mapM_ (toView . uncurry CRRcvFileSubError) . filterErrors . resultsFor rs
|
||||
pendingConnSubsToView :: Map ConnId (Either AgentErrorType ()) -> Map ConnId PendingContactConnection -> m ()
|
||||
|
||||
Reference in New Issue
Block a user