From 33c36c810135665860ad77a482ee6e4bbafb7745 Mon Sep 17 00:00:00 2001 From: Alexander Bondarenko <486682+dpwiz@users.noreply.github.com> Date: Fri, 26 Apr 2024 18:43:49 +0300 Subject: [PATCH] add Connection wholesale --- src/Simplex/Chat.hs | 8 +++----- src/Simplex/Chat/Controller.hs | 5 +---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index acd9885377..2d02b6ac19 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -2181,7 +2181,7 @@ processChatCommand' vr = \case Nothing -> "idle" Just Nothing -> "waiting" Just (Just _async) -> "working" - conn@Connection {connStatus, createdAt} <- + connection <- withStore (\db -> getConnectionEntity db vr user acId) >>= \case RcvDirectMsgConnection {entityConnection} -> pure entityConnection RcvGroupMsgConnection {entityConnection} -> pure entityConnection @@ -2201,9 +2201,7 @@ processChatCommand' vr = \case smpClientStatus, subWorkerStatus, queueStatus = tshow rqStatus, - connStatus_ = connStatus, - connAuthErrors = (authErrCounter conn, connDisabled conn), - createdAt = createdAt + connection } DebugLocks -> lift $ do chatLockName <- atomically . tryReadTMVar =<< asks chatLock @@ -7576,4 +7574,4 @@ dummyFileDescr = FileDescr {fileDescrText = "", fileDescrPartNo = 0, fileDescrCo agentDeliveryStatus :: AgentConnId -> (AgentDeliveryStatus -> AgentDeliveryStatus) -> CM' () agentDeliveryStatus acId f = do ads <- asks agentDeliveryStatuses - atomically $ TM.lookup acId ads >>= mapM_ (`modifyTVar'`f) + atomically $ TM.lookup acId ads >>= mapM_ (`modifyTVar'` f) diff --git a/src/Simplex/Chat/Controller.hs b/src/Simplex/Chat/Controller.hs index d54ac52d48..daf9c3cf8a 100644 --- a/src/Simplex/Chat/Controller.hs +++ b/src/Simplex/Chat/Controller.hs @@ -786,10 +786,7 @@ data DebugConnectionStatus = DebugConnectionStatus server :: (Text, String), -- what's the server for this connection? -- XXX: reveals private servers and association smpClientStatus :: Text, -- is there an active client for it? subWorkerStatus :: Text, -- a session was recently restarted and tries to resubscribe - -- from Connection - connStatus_ :: ConnStatus, -- does the protocol permits delivery - connAuthErrors :: (Int, Bool), -- number of AUTH errors before connection gets disabled - createdAt :: UTCTime + connection :: Connection } deriving (Show)