From 6ee7082269bcddafaca8dd1a00b04823ef7705e6 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Sat, 4 May 2024 09:57:25 +0100 Subject: [PATCH] fixes --- src/Simplex/Messaging/Agent.hs | 4 ++-- src/Simplex/Messaging/Agent/Client.hs | 2 +- src/Simplex/Messaging/Client.hs | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Simplex/Messaging/Agent.hs b/src/Simplex/Messaging/Agent.hs index 1ceed1f6e..0b879195c 100644 --- a/src/Simplex/Messaging/Agent.hs +++ b/src/Simplex/Messaging/Agent.hs @@ -1963,7 +1963,7 @@ subscriber c@AgentClient {subQ, msgQ} = forever $ do runExceptT (processSMPTransmission c t) >>= \case Left e -> do logError $ tshow e - -- atomically $ writeTBQueue subQ ("", "", APC SAEConn $ ERR e) + atomically $ writeTBQueue subQ ("", "", APC SAEConn $ ERR e) Right _ -> return () cleanupManager :: AgentClient -> AM' () @@ -2054,7 +2054,7 @@ processSMPTransmission c@AgentClient {smpClients, subQ} (tSess@(_, srv, _), _v, SMP.MSG msg@SMP.RcvMessage {msgId = srvMsgId} -> void . handleNotifyAck $ do isGET <- atomically $ hasGetLock c rq - unless isGET checkSubscription + when (not isGET && isResponse) checkSubscription msg' <- decryptSMPMessage rq msg ack' <- handleNotifyAck $ case msg' of SMP.ClientRcvMsgBody {msgTs = srvTs, msgFlags, msgBody} -> processClientMsg srvTs msgFlags msgBody diff --git a/src/Simplex/Messaging/Agent/Client.hs b/src/Simplex/Messaging/Agent/Client.hs index 22b49a719..dee604dc9 100644 --- a/src/Simplex/Messaging/Agent/Client.hs +++ b/src/Simplex/Messaging/Agent/Client.hs @@ -1188,7 +1188,7 @@ subscribeQueues c qs = do if active then when (hasTempErrors rs) resubscribe $> rs else do - unless active $ logWarn "subcription batch result for replaced SMP client, resubscribing" + logWarn "subcription batch result for replaced SMP client, resubscribing" resubscribe $> L.map (second $ \_ -> Left PCENetworkError) rs where tSess = transportSession' smp diff --git a/src/Simplex/Messaging/Client.hs b/src/Simplex/Messaging/Client.hs index 0d8ec0df8..e9a9fc582 100644 --- a/src/Simplex/Messaging/Client.hs +++ b/src/Simplex/Messaging/Client.hs @@ -533,6 +533,7 @@ subscribeSMPQueue c@ProtocolClient {client_ = PClient {sendPings}} rpKey rId = d liftIO . atomically $ writeTVar sendPings True sendSMPCommand c (Just rpKey) rId SUB >>= \case OK -> pure () + SUBOK -> pure () cmd@MSG {} -> liftIO $ writeSMPMessage c rId cmd r -> throwE . PCEUnexpectedResponse $ bshow r