add AERR to pass background errors to client

This commit is contained in:
Alexander Bondarenko
2024-05-02 21:17:02 +03:00
parent 51fe9009f0
commit 1d4e31cca9
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -1965,7 +1965,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 SAENone $ AERR e)
Right _ -> return ()
cleanupManager :: AgentClient -> AM' ()
+7
View File
@@ -411,6 +411,7 @@ data ACommand (p :: AParty) (e :: AEntity) where
STAT :: ConnectionStats -> ACommand Agent AEConn
OK :: ACommand Agent AEConn
ERR :: AgentErrorType -> ACommand Agent AEConn
AERR :: AgentErrorType -> ACommand Agent AENone
SUSPENDED :: ACommand Agent AENone
-- XFTP commands and responses
RFPROG :: Int64 -> Int64 -> ACommand Agent AERcvFile
@@ -474,6 +475,7 @@ data ACommandTag (p :: AParty) (e :: AEntity) where
STAT_ :: ACommandTag Agent AEConn
OK_ :: ACommandTag Agent AEConn
ERR_ :: ACommandTag Agent AEConn
AERR_ :: ACommandTag Agent AENone
SUSPENDED_ :: ACommandTag Agent AENone
-- XFTP commands and responses
RFDONE_ :: ACommandTag Agent AERcvFile
@@ -530,6 +532,7 @@ aCommandTag = \case
STAT _ -> STAT_
OK -> OK_
ERR _ -> ERR_
AERR _ -> AERR_
SUSPENDED -> SUSPENDED_
RFPROG {} -> RFPROG_
RFDONE {} -> RFDONE_
@@ -1677,6 +1680,7 @@ instance StrEncoding ACmdTag where
"STAT" -> ct STAT_
"OK" -> ct OK_
"ERR" -> ct ERR_
"AERR" -> nt AERR_
"SUSPENDED" -> nt SUSPENDED_
"RFPROG" -> at SAERcvFile RFPROG_
"RFDONE" -> at SAERcvFile RFDONE_
@@ -1735,6 +1739,7 @@ instance (APartyI p, AEntityI e) => StrEncoding (ACommandTag p e) where
STAT_ -> "STAT"
OK_ -> "OK"
ERR_ -> "ERR"
AERR_ -> "AERR"
SUSPENDED_ -> "SUSPENDED"
RFPROG_ -> "RFPROG"
RFDONE_ -> "RFDONE"
@@ -1801,6 +1806,7 @@ commandP binaryP =
STAT_ -> s (STAT <$> strP)
OK_ -> pure OK
ERR_ -> s (ERR <$> strP)
AERR_ -> s (AERR <$> strP)
SUSPENDED_ -> pure SUSPENDED
RFPROG_ -> s (RFPROG <$> A.decimal <* A.space <*> A.decimal)
RFDONE_ -> s (RFDONE <$> strP)
@@ -1869,6 +1875,7 @@ serializeCommand = \case
STAT srvs -> s (STAT_, srvs)
CON pqEnc -> s (CON_, pqEnc)
ERR e -> s (ERR_, e)
AERR e -> s (AERR_, e)
OK -> s OK_
SUSPENDED -> s SUSPENDED_
RFPROG rcvd total -> s (RFPROG_, rcvd, total)