fix: connection-level locks (#543)

* fix: connection-level locks

* add context to store error

* convert SERatchetNotFound to CONN NOT_FOUND
This commit is contained in:
Evgeny Poberezkin
2022-10-04 14:36:51 +01:00
committed by GitHub
parent f4baa5d672
commit 0fa40fbfb0
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -726,7 +726,7 @@ runCommandProcessing c@AgentClient {subQ} server = do
DEL -> tryCommand $ deleteConnection' c connId >> notify OK
_ -> notify $ ERR $ INTERNAL $ "unsupported async command " <> show (aCommandTag cmd)
AInternalCommand cmd -> case server of
Just _srv -> case cmd of
Just _srv -> withConnLock c connId $ case cmd of
ICAckDel _rId srvMsgId msgId -> tryCommand $ ack _rId srvMsgId >> withStore' c (\db -> deleteMsg db connId msgId)
ICAck _rId srvMsgId -> tryCommand $ ack _rId srvMsgId
ICAllowSecure _rId senderKey -> tryCommand $ do
+1
View File
@@ -850,6 +850,7 @@ withStore c action = do
storeError :: StoreError -> AgentErrorType
storeError = \case
SEConnNotFound -> CONN NOT_FOUND
SERatchetNotFound -> CONN NOT_FOUND
SEConnDuplicate -> CONN DUPLICATE
SEBadConnType CRcv -> CONN SIMPLEX
SEBadConnType CSnd -> CONN SIMPLEX