Skip to content

Commit

Permalink
core: prevent failure to acknowledge a group message in case its pars…
Browse files Browse the repository at this point in the history
…ing or saving fails (potential cause for stuck delivery) (#1887)
  • Loading branch information
epoberezkin committed Feb 4, 2023
1 parent c90d911 commit 0427d2e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Simplex/Chat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2102,8 +2102,8 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
saveConnInfo conn connInfo
MSG meta _msgFlags msgBody -> do
cmdId <- createAckCmd conn
_ <- saveRcvMSG conn (ConnectionId connId) meta msgBody cmdId
withAckMessage agentConnId cmdId meta $ pure ()
withAckMessage agentConnId cmdId meta . void $
saveRcvMSG conn (ConnectionId connId) meta msgBody cmdId
SENT msgId ->
sentMsgDeliveryEvent conn msgId
OK ->
Expand Down Expand Up @@ -2345,9 +2345,9 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
when (memberCategory m == GCPreMember) $ probeMatchingContacts ct connectedIncognito
MSG msgMeta _msgFlags msgBody -> do
cmdId <- createAckCmd conn
msg@RcvMessage {chatMsgEvent = ACME _ event} <- saveRcvMSG conn (GroupId groupId) msgMeta msgBody cmdId
updateChatLock "groupMessage" event
withAckMessage agentConnId cmdId msgMeta $
withAckMessage agentConnId cmdId msgMeta $ do
msg@RcvMessage {chatMsgEvent = ACME _ event} <- saveRcvMSG conn (GroupId groupId) msgMeta msgBody cmdId
updateChatLock "groupMessage" event
case event of
XMsgNew mc -> canSend $ newGroupContentMessage gInfo m mc msg msgMeta
XMsgUpdate sharedMsgId mContent ttl live -> canSend $ groupMessageUpdate gInfo m sharedMsgId mContent msg msgMeta ttl live
Expand Down

0 comments on commit 0427d2e

Please sign in to comment.