diff --git a/cabal.project b/cabal.project index ff3f05eadc..a3d8c16890 100644 --- a/cabal.project +++ b/cabal.project @@ -12,7 +12,7 @@ constraints: zip +disable-bzip2 +disable-zstd source-repository-package type: git location: https://github.com/simplex-chat/simplexmq.git - tag: 853d9bcc6ff3438f5dd4aa648103829dc8056f3c + tag: bb1d31e459337f5d2de05f4495ff50d0a8788dff source-repository-package type: git diff --git a/scripts/nix/sha256map.nix b/scripts/nix/sha256map.nix index 563dfc562a..b3858de700 100644 --- a/scripts/nix/sha256map.nix +++ b/scripts/nix/sha256map.nix @@ -1,5 +1,5 @@ { - "https://github.com/simplex-chat/simplexmq.git"."853d9bcc6ff3438f5dd4aa648103829dc8056f3c" = "0r4mjwcw0wjdr97xma6s2j866n5s6rz33vgigi1vj3x74bmh7k9f"; + "https://github.com/simplex-chat/simplexmq.git"."bb1d31e459337f5d2de05f4495ff50d0a8788dff" = "1nbd80anzh2k5hnf330vlcda0zdn2lzlcnjmi3qz2jdkmmzcc3b6"; "https://github.com/simplex-chat/hs-socks.git"."a30cc7a79a08d8108316094f8f2f82a0c5e1ac51" = "0yasvnr7g91k76mjkamvzab2kvlb1g5pspjyjn2fr6v83swjhj38"; "https://github.com/simplex-chat/direct-sqlcipher.git"."f814ee68b16a9447fbb467ccc8f29bdd3546bfd9" = "1ql13f4kfwkbaq7nygkxgw84213i0zm7c1a8hwvramayxl38dq5d"; "https://github.com/simplex-chat/sqlcipher-simple.git"."a46bd361a19376c5211f1058908fc0ae6bf42446" = "1z0r78d8f0812kxbgsm735qf6xx8lvaz27k1a0b4a2m0sshpd5gl"; diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index d0eafd8927..045d1b9deb 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -424,7 +424,7 @@ subscribeUsers onlyNeeded users = do subscribe vr us' where subscribe :: VersionRangeChat -> [User] -> CM' () - subscribe vr = mapM_ $ runExceptT . subscribeUserConnections vr onlyNeeded + subscribe vr = mapM_ $ runExceptT . subscribeUserConnections vr onlyNeeded Agent.subscribeConnections startFilesToReceive :: [User] -> CM' () startFilesToReceive users = do @@ -3379,9 +3379,12 @@ agentSubscriber = do where run action = action `catchChatError'` (toView' . CRChatError Nothing) -subscribeUserConnections :: VersionRangeChat -> Bool -> User -> CM () -subscribeUserConnections vr onlyNeeded user = do +type AgentBatchSubscribe = AgentClient -> [ConnId] -> ExceptT AgentErrorType IO (Map ConnId (Either AgentErrorType ())) + +subscribeUserConnections :: VersionRangeChat -> Bool -> AgentBatchSubscribe -> User -> CM () +subscribeUserConnections vr onlyNeeded agentBatchSubscribe user = do -- get user connections + ce <- asks $ subscriptionEvents . config (conns, ctConns, ucs, gs, mConns, sfts, rfts, pcConns) <- if onlyNeeded then do @@ -3400,9 +3403,9 @@ subscribeUserConnections vr onlyNeeded user = do pure (conns, ctConns, ucs, gs, mConns, sfts, rfts, pcConns) -- detach subscription and result processing void . lift . forkIO . runSubscriber $ do - rs <- withAgent (`Agent.subscribeConnections` conns) -- subscribe using batched commands + -- subscribe using batched commands + rs <- withAgent $ \a -> agentBatchSubscribe a conns let (errs, _oks) = M.mapEither id rs - ce <- asks $ subscriptionEvents . config refs <- if ce then withStore' $ \db -> getConnectionsContacts db (M.keys errs) else pure [] let connRefs = M.fromList $ map (\ContactRef {agentConnId = AgentConnId acId, localDisplayName} -> (acId, localDisplayName)) refs contactSubsToView errs ctConns connRefs ce