Skip to content

Commit 38e8999

Browse files
authored
agent: service subscription events (#1671)
* agent: use server keyhash when loading service record * agent: process queue/service associations with delayed subscription results * agent: service subscription events
1 parent 5e9b164 commit 38e8999

File tree

12 files changed

+125
-84
lines changed

12 files changed

+125
-84
lines changed

src/Simplex/Messaging/Agent.hs

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ import Simplex.Messaging.Agent.Store.Entity
194194
import Simplex.Messaging.Agent.Store.Interface (closeDBStore, execSQL, getCurrentMigrations)
195195
import Simplex.Messaging.Agent.Store.Shared (UpMigration (..), upMigration)
196196
import qualified Simplex.Messaging.Agent.TSessionSubs as SS
197-
import Simplex.Messaging.Client (NetworkRequestMode (..), SMPClientError, ServerTransmission (..), ServerTransmissionBatch, TransportSessionMode (..), nonBlockingWriteTBQueue, smpErrorClientNotice, temporaryClientError, unexpectedResponse)
197+
import Simplex.Messaging.Client (NetworkRequestMode (..), ProtocolClientError (..), SMPClientError, ServerTransmission (..), ServerTransmissionBatch, TransportSessionMode (..), nonBlockingWriteTBQueue, smpErrorClientNotice, temporaryClientError, unexpectedResponse)
198198
import qualified Simplex.Messaging.Crypto as C
199199
import Simplex.Messaging.Crypto.File (CryptoFile, CryptoFileArgs)
200200
import Simplex.Messaging.Crypto.Ratchet (PQEncryption, PQSupport (..), pattern PQEncOff, pattern PQEncOn, pattern PQSupportOff, pattern PQSupportOn)
@@ -222,6 +222,7 @@ import Simplex.Messaging.Protocol
222222
SParty (..),
223223
SProtocolType (..),
224224
ServiceSub (..),
225+
ServiceSubResult,
225226
SndPublicAuthKey,
226227
SubscriptionMode (..),
227228
UserProtocol,
@@ -232,7 +233,7 @@ import qualified Simplex.Messaging.Protocol as SMP
232233
import Simplex.Messaging.ServiceScheme (ServiceScheme (..))
233234
import Simplex.Messaging.SystemTime
234235
import qualified Simplex.Messaging.TMap as TM
235-
import Simplex.Messaging.Transport (SMPVersion)
236+
import Simplex.Messaging.Transport (SMPVersion, THClientService' (..), THandleAuth (..), THandleParams (..))
236237
import Simplex.Messaging.Util
237238
import Simplex.Messaging.Version
238239
import Simplex.RemoteControl.Client
@@ -502,7 +503,7 @@ resubscribeConnections :: AgentClient -> [ConnId] -> AE (Map ConnId (Either Agen
502503
resubscribeConnections c = withAgentEnv c . resubscribeConnections' c
503504
{-# INLINE resubscribeConnections #-}
504505

505-
subscribeClientServices :: AgentClient -> UserId -> AE (Map SMPServer (Either AgentErrorType ServiceSub))
506+
subscribeClientServices :: AgentClient -> UserId -> AE (Map SMPServer (Either AgentErrorType ServiceSubResult))
506507
subscribeClientServices c = withAgentEnv c . subscribeClientServices' c
507508
{-# INLINE subscribeClientServices #-}
508509

@@ -1355,28 +1356,23 @@ toConnResult connId rs = case M.lookup connId rs of
13551356
Just (Left e) -> throwE e
13561357
_ -> throwE $ INTERNAL $ "no result for connection " <> B.unpack connId
13571358

1358-
type QCmdResult a = (QueueStatus, Either AgentErrorType a)
1359-
1360-
type QDelResult = QCmdResult ()
1361-
1362-
type QSubResult = QCmdResult (Maybe SMP.ServiceId)
1359+
type QCmdResult = (QueueStatus, Either AgentErrorType ())
13631360

13641361
subscribeConnections' :: AgentClient -> [ConnId] -> AM (Map ConnId (Either AgentErrorType ()))
13651362
subscribeConnections' _ [] = pure M.empty
13661363
subscribeConnections' c connIds = subscribeConnections_ c . zip connIds =<< withStore' c (`getConnSubs` connIds)
13671364

13681365
subscribeConnections_ :: AgentClient -> [(ConnId, Either StoreError SomeConnSub)] -> AM (Map ConnId (Either AgentErrorType ()))
13691366
subscribeConnections_ c conns = do
1370-
-- TODO [certs rcv] - it should exclude connections already associated, and then if some don't deliver any response they may be unassociated
13711367
let (subRs, cs) = foldr partitionResultsConns ([], []) conns
13721368
resumeDelivery cs
13731369
resumeConnCmds c $ map fst cs
1370+
-- queue/service association is handled in the client
13741371
rcvRs <- lift $ connResults <$> subscribeQueues c False (concatMap rcvQueues cs)
1375-
rcvRs' <- storeClientServiceAssocs rcvRs
13761372
ns <- asks ntfSupervisor
1377-
lift $ whenM (liftIO $ hasInstantNotifications ns) . void . forkIO . void $ sendNtfCreate ns rcvRs' cs
1373+
lift $ whenM (liftIO $ hasInstantNotifications ns) . void . forkIO . void $ sendNtfCreate ns rcvRs cs
13781374
-- union is left-biased
1379-
let rs = rcvRs' `M.union` subRs
1375+
let rs = rcvRs `M.union` subRs
13801376
notifyResultError rs
13811377
pure rs
13821378
where
@@ -1400,24 +1396,21 @@ subscribeConnections_ c conns = do
14001396
_ -> Left $ INTERNAL "unexpected queue status"
14011397
rcvQueues :: (ConnId, SomeConnSub) -> [RcvQueueSub]
14021398
rcvQueues (_, SomeConn _ conn) = connRcvQueues conn
1403-
connResults :: [(RcvQueueSub, Either AgentErrorType (Maybe SMP.ServiceId))] -> Map ConnId (Either AgentErrorType (Maybe SMP.ServiceId))
1399+
connResults :: [(RcvQueueSub, Either AgentErrorType (Maybe SMP.ServiceId))] -> Map ConnId (Either AgentErrorType ())
14041400
connResults = M.map snd . foldl' addResult M.empty
14051401
where
14061402
-- collects results by connection ID
1407-
addResult :: Map ConnId QSubResult -> (RcvQueueSub, Either AgentErrorType (Maybe SMP.ServiceId)) -> Map ConnId QSubResult
1408-
addResult rs (RcvQueueSub {connId, status}, r) = M.alter (combineRes (status, r)) connId rs
1403+
addResult :: Map ConnId QCmdResult -> (RcvQueueSub, Either AgentErrorType (Maybe SMP.ServiceId)) -> Map ConnId QCmdResult
1404+
addResult rs (RcvQueueSub {connId, status}, r) = M.alter (combineRes (status, () <$ r)) connId rs
14091405
-- combines two results for one connection, by using only Active queues (if there is at least one Active queue)
1410-
combineRes :: QSubResult -> Maybe QSubResult -> Maybe QSubResult
1406+
combineRes :: QCmdResult -> Maybe QCmdResult -> Maybe QCmdResult
14111407
combineRes r' (Just r) = Just $ if order r <= order r' then r else r'
14121408
combineRes r' _ = Just r'
1413-
order :: QSubResult -> Int
1409+
order :: QCmdResult -> Int
14141410
order (Active, Right _) = 1
14151411
order (Active, _) = 2
14161412
order (_, Right _) = 3
14171413
order _ = 4
1418-
-- TODO [certs rcv] store associations of queues with client service ID
1419-
storeClientServiceAssocs :: Map ConnId (Either AgentErrorType (Maybe SMP.ServiceId)) -> AM (Map ConnId (Either AgentErrorType ()))
1420-
storeClientServiceAssocs = pure . M.map (() <$)
14211414
sendNtfCreate :: NtfSupervisor -> Map ConnId (Either AgentErrorType ()) -> [(ConnId, SomeConnSub)] -> AM' ()
14221415
sendNtfCreate ns rcvRs cs = do
14231416
let oks = M.keysSet $ M.filter (either temporaryAgentError $ const True) rcvRs
@@ -1522,14 +1515,14 @@ resubscribeConnections' c connIds = do
15221515
rqs' -> anyM $ map (atomically . hasActiveSubscription c) rqs'
15231516

15241517
-- TODO [certs rcv] compare hash. possibly, it should return both expected and returned counts
1525-
subscribeClientServices' :: AgentClient -> UserId -> AM (Map SMPServer (Either AgentErrorType ServiceSub))
1518+
subscribeClientServices' :: AgentClient -> UserId -> AM (Map SMPServer (Either AgentErrorType ServiceSubResult))
15261519
subscribeClientServices' c userId =
15271520
ifM useService subscribe $ throwError $ CMD PROHIBITED "no user service allowed"
15281521
where
15291522
useService = liftIO $ (Just True ==) <$> TM.lookupIO userId (useClientServices c)
15301523
subscribe = do
15311524
srvs <- withStore' c (`getClientServiceServers` userId)
1532-
lift $ M.fromList <$> mapConcurrently (\(srv, ServiceSub _ n idsHash) -> fmap (srv,) $ tryAllErrors' $ subscribeClientService c userId srv n idsHash) srvs
1525+
lift $ M.fromList <$> mapConcurrently (\(srv, ServiceSub _ n idsHash) -> fmap (srv,) $ tryAllErrors' $ subscribeClientService c False userId srv n idsHash) srvs
15331526

15341527
-- requesting messages sequentially, to reduce memory usage
15351528
getConnectionMessages' :: AgentClient -> NonEmpty ConnMsgReq -> AM' (NonEmpty (Either AgentErrorType (Maybe SMPMsgMeta)))
@@ -2383,13 +2376,13 @@ deleteConnQueues c nm waitDelivery ntf rqs = do
23832376
connResults = M.map snd . foldl' addResult M.empty
23842377
where
23852378
-- collects results by connection ID
2386-
addResult :: Map ConnId QDelResult -> (RcvQueue, Either AgentErrorType ()) -> Map ConnId QDelResult
2379+
addResult :: Map ConnId QCmdResult -> (RcvQueue, Either AgentErrorType ()) -> Map ConnId QCmdResult
23872380
addResult rs (RcvQueue {connId, status}, r) = M.alter (combineRes (status, r)) connId rs
23882381
-- combines two results for one connection, by prioritizing errors in Active queues
2389-
combineRes :: QDelResult -> Maybe QDelResult -> Maybe QDelResult
2382+
combineRes :: QCmdResult -> Maybe QCmdResult -> Maybe QCmdResult
23902383
combineRes r' (Just r) = Just $ if order r <= order r' then r else r'
23912384
combineRes r' _ = Just r'
2392-
order :: QDelResult -> Int
2385+
order :: QCmdResult -> Int
23932386
order (Active, Left _) = 1
23942387
order (_, Left _) = 2
23952388
order _ = 3
@@ -2840,11 +2833,17 @@ data ACKd = ACKd | ACKPending
28402833
-- It cannot be finally, as sometimes it needs to be ACK+DEL,
28412834
-- and sometimes ACK has to be sent from the consumer.
28422835
processSMPTransmissions :: AgentClient -> ServerTransmissionBatch SMPVersion ErrorType BrokerMsg -> AM' ()
2843-
processSMPTransmissions c@AgentClient {subQ} (tSess@(userId, srv, _), _v, sessId, ts) = do
2836+
processSMPTransmissions c@AgentClient {subQ} (tSess@(userId, srv, _), THandleParams {thAuth, sessionId = sessId}, ts) = do
28442837
upConnIds <- newTVarIO []
2838+
serviceRQs <- newTVarIO ([] :: [RcvQueue])
28452839
forM_ ts $ \(entId, t) -> case t of
28462840
STEvent msgOrErr
2847-
| entId == SMP.NoEntity -> pure () -- TODO [certs rcv] process SALL
2841+
| entId == SMP.NoEntity -> case msgOrErr of
2842+
Right msg -> case msg of
2843+
SMP.ALLS -> notifySub c $ SERVICE_ALL srv
2844+
SMP.ERR e -> notifyErr "" $ PCEProtocolError e
2845+
_ -> logError $ "unexpected event: " <> tshow msg
2846+
Left e -> notifyErr "" e
28482847
| otherwise -> withRcvConn entId $ \rq@RcvQueue {connId} conn -> case msgOrErr of
28492848
Right msg -> runProcessSMP rq conn (toConnData conn) msg
28502849
Left e -> lift $ do
@@ -2853,11 +2852,10 @@ processSMPTransmissions c@AgentClient {subQ} (tSess@(userId, srv, _), _v, sessId
28532852
STResponse (Cmd SRecipient cmd) respOrErr ->
28542853
withRcvConn entId $ \rq conn -> case cmd of
28552854
SMP.SUB -> case respOrErr of
2856-
Right SMP.OK -> liftIO $ processSubOk rq upConnIds
2857-
-- TODO [certs rcv] associate queue with the service
2858-
Right (SMP.SOK _serviceId_) -> liftIO $ processSubOk rq upConnIds
2855+
Right SMP.OK -> liftIO $ processSubOk rq upConnIds serviceRQs Nothing
2856+
Right (SMP.SOK serviceId_) -> liftIO $ processSubOk rq upConnIds serviceRQs serviceId_
28592857
Right msg@SMP.MSG {} -> do
2860-
liftIO $ processSubOk rq upConnIds -- the connection is UP even when processing this particular message fails
2858+
liftIO $ processSubOk rq upConnIds serviceRQs Nothing -- the connection is UP even when processing this particular message fails
28612859
runProcessSMP rq conn (toConnData conn) msg
28622860
Right r -> lift $ processSubErr rq $ unexpectedResponse r
28632861
Left e -> lift $ unless (temporaryClientError e) $ processSubErr rq e -- timeout/network was already reported
@@ -2873,6 +2871,7 @@ processSMPTransmissions c@AgentClient {subQ} (tSess@(userId, srv, _), _v, sessId
28732871
unless (null connIds) $ do
28742872
notify' "" $ UP srv connIds
28752873
atomically $ incSMPServerStat' c userId srv connSubscribed $ length connIds
2874+
readTVarIO serviceRQs >>= processRcvServiceAssocs c
28762875
where
28772876
withRcvConn :: SMP.RecipientId -> (forall c. RcvQueue -> Connection c -> AM ()) -> AM' ()
28782877
withRcvConn rId a = do
@@ -2882,11 +2881,13 @@ processSMPTransmissions c@AgentClient {subQ} (tSess@(userId, srv, _), _v, sessId
28822881
tryAllErrors' (a rq conn) >>= \case
28832882
Left e -> notify' connId (ERR e)
28842883
Right () -> pure ()
2885-
processSubOk :: RcvQueue -> TVar [ConnId] -> IO ()
2886-
processSubOk rq@RcvQueue {connId} upConnIds =
2884+
processSubOk :: RcvQueue -> TVar [ConnId] -> TVar [RcvQueue] -> Maybe SMP.ServiceId -> IO ()
2885+
processSubOk rq@RcvQueue {connId} upConnIds serviceRQs serviceId_ =
28872886
atomically . whenM (isPendingSub rq) $ do
28882887
SS.addActiveSub tSess sessId rq $ currentSubs c
28892888
modifyTVar' upConnIds (connId :)
2889+
when (isJust serviceId_ && serviceId_ == clientServiceId_) $ modifyTVar' serviceRQs (rq :)
2890+
clientServiceId_ = (\THClientService {serviceId} -> serviceId) <$> (clientService =<< thAuth)
28902891
processSubErr :: RcvQueue -> SMPClientError -> AM' ()
28912892
processSubErr rq@RcvQueue {connId} e = do
28922893
atomically . whenM (isPendingSub rq) $

src/Simplex/Messaging/Agent/Client.hs

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module Simplex.Messaging.Agent.Client
5050
subscribeQueues,
5151
subscribeUserServerQueues,
5252
subscribeClientService,
53+
processRcvServiceAssocs,
5354
processClientNotices,
5455
getQueueMessage,
5556
decryptSMPMessage,
@@ -280,6 +281,7 @@ import Simplex.Messaging.Protocol
280281
SMPMsgMeta (..),
281282
SProtocolType (..),
282283
ServiceSub (..),
284+
ServiceSubResult (..),
283285
SndPublicAuthKey,
284286
SubscriptionMode (..),
285287
NewNtfCreds (..),
@@ -292,6 +294,7 @@ import Simplex.Messaging.Protocol
292294
XFTPServerWithAuth,
293295
pattern NoEntity,
294296
senderCanSecure,
297+
serviceSubResult,
295298
)
296299
import qualified Simplex.Messaging.Protocol as SMP
297300
import Simplex.Messaging.Protocol.Types
@@ -785,6 +788,7 @@ smpClientDisconnected c@AgentClient {active, smpClients, smpProxiedRelays} tSess
785788
serverDown (qs, conns, serviceSub_) = whenM (readTVarIO active) $ do
786789
notifySub c $ hostEvent' DISCONNECT client
787790
unless (null conns) $ notifySub c $ DOWN srv conns
791+
mapM_ (notifySub c . SERVICE_DOWN srv) serviceSub_
788792
unless (null qs && isNothing serviceSub_) $ do
789793
releaseGetLocksIO c qs
790794
mode <- getSessionModeIO c
@@ -1514,7 +1518,7 @@ newRcvQueue_ c nm userId connId (ProtoServerWithAuth srv auth) vRange cqrd enabl
15141518
newErr = throwE . BROKER (B.unpack $ strEncode srv) . UNEXPECTED . ("Create queue: " <>)
15151519

15161520
processSubResults :: AgentClient -> SMPTransportSession -> SessionId -> Maybe ServiceId -> NonEmpty (RcvQueueSub, Either SMPClientError (Maybe ServiceId)) -> STM ([RcvQueueSub], [(RcvQueueSub, Maybe ClientNotice)])
1517-
processSubResults c tSess@(userId, srv, _) sessId smpServiceId rs = do
1521+
processSubResults c tSess@(userId, srv, _) sessId serviceId_ rs = do
15181522
pending <- SS.getPendingSubs tSess $ currentSubs c
15191523
let (failed, subscribed@(qs, sQs), notices, ignored) = foldr (partitionResults pending) (M.empty, ([], []), [], 0) rs
15201524
unless (M.null failed) $ do
@@ -1541,10 +1545,10 @@ processSubResults c tSess@(userId, srv, _) sessId smpServiceId rs = do
15411545
| otherwise -> (failed', subscribed, notices, ignored)
15421546
where
15431547
failed' = M.insert rcvId e failed
1544-
Right serviceId_
1548+
Right serviceId_'
15451549
| rcvId `M.member` pendingSubs ->
1546-
let subscribed' = case (smpServiceId, serviceId_, pendingSS) of
1547-
(Just sId, Just sId', Just ServiceSub {serviceId}) | sId == sId' && sId == serviceId -> (qs, rq : sQs)
1550+
let subscribed' = case (serviceId_, serviceId_', pendingSS) of
1551+
(Just sId, Just sId', Just ServiceSub {smpServiceId}) | sId == sId' && sId == smpServiceId -> (qs, rq : sQs)
15481552
_ -> (rq : qs, sQs)
15491553
in (failed, subscribed', notices', ignored)
15501554
| otherwise -> (failed, subscribed, notices', ignored + 1)
@@ -1692,7 +1696,8 @@ subscribeSessQueues_ c withEvents qs = sendClientBatch_ "SUB" False subscribe_ c
16921696
sessId = sessionId $ thParams smp
16931697
smpServiceId = (\THClientService {serviceId} -> serviceId) <$> smpClientService smp
16941698

1695-
processRcvServiceAssocs :: AgentClient -> [RcvQueueSub] -> AM' ()
1699+
processRcvServiceAssocs :: SMPQueue q => AgentClient -> [q] -> AM' ()
1700+
processRcvServiceAssocs _ [] = pure ()
16961701
processRcvServiceAssocs c serviceQs =
16971702
withStore' c (`setRcvServiceAssocs` serviceQs) `catchAllErrors'` \e -> do
16981703
logError $ "processClientNotices error: " <> tshow e
@@ -1709,17 +1714,16 @@ processClientNotices c@AgentClient {presetServers} tSess notices = do
17091714
logError $ "processClientNotices error: " <> tshow e
17101715
notifySub' c "" $ ERR e
17111716

1712-
resubscribeClientService :: AgentClient -> SMPTransportSession -> ServiceSub -> AM ServiceSub
1713-
resubscribeClientService c tSess (ServiceSub _ n idsHash) =
1714-
withServiceClient c tSess $ \smp _ -> do
1715-
subscribeClientService_ c tSess smp n idsHash
1717+
resubscribeClientService :: AgentClient -> SMPTransportSession -> ServiceSub -> AM ServiceSubResult
1718+
resubscribeClientService c tSess serviceSub =
1719+
withServiceClient c tSess $ \smp _ -> subscribeClientService_ c True tSess smp serviceSub
17161720

1717-
subscribeClientService :: AgentClient -> UserId -> SMPServer -> Int64 -> IdsHash -> AM ServiceSub
1718-
subscribeClientService c userId srv n idsHash =
1721+
subscribeClientService :: AgentClient -> Bool -> UserId -> SMPServer -> Int64 -> IdsHash -> AM ServiceSubResult
1722+
subscribeClientService c withEvent userId srv n idsHash =
17191723
withServiceClient c tSess $ \smp smpServiceId -> do
17201724
let serviceSub = ServiceSub smpServiceId n idsHash
17211725
atomically $ SS.setPendingServiceSub tSess serviceSub $ currentSubs c
1722-
subscribeClientService_ c tSess smp n idsHash
1726+
subscribeClientService_ c withEvent tSess smp serviceSub
17231727
where
17241728
tSess = (userId, srv, Nothing)
17251729

@@ -1730,14 +1734,15 @@ withServiceClient c tSess action =
17301734
Just smpServiceId -> action smp smpServiceId
17311735
Nothing -> throwE PCEServiceUnavailable
17321736

1733-
subscribeClientService_ :: AgentClient -> SMPTransportSession -> SMPClient -> Int64 -> IdsHash -> ExceptT SMPClientError IO ServiceSub
1734-
subscribeClientService_ c tSess smp n idsHash = do
1735-
-- TODO [certs rcv] handle error
1736-
serviceSub' <- subscribeService smp SMP.SRecipientService n idsHash
1737+
subscribeClientService_ :: AgentClient -> Bool -> SMPTransportSession -> SMPClient -> ServiceSub -> ExceptT SMPClientError IO ServiceSubResult
1738+
subscribeClientService_ c withEvent tSess@(_, srv, _) smp expected@(ServiceSub _ n idsHash) = do
1739+
subscribed <- subscribeService smp SMP.SRecipientService n idsHash
17371740
let sessId = sessionId $ thParams smp
1741+
r = serviceSubResult expected subscribed
17381742
atomically $ whenM (activeClientSession c tSess sessId) $
1739-
SS.setActiveServiceSub tSess sessId serviceSub' $ currentSubs c
1740-
pure serviceSub'
1743+
SS.setActiveServiceSub tSess sessId subscribed $ currentSubs c
1744+
when withEvent $ notifySub c $ SERVICE_UP srv r
1745+
pure r
17411746

17421747
activeClientSession :: AgentClient -> SMPTransportSession -> SessionId -> STM Bool
17431748
activeClientSession c tSess sessId = sameSess <$> tryReadSessVar tSess (smpClients c)

src/Simplex/Messaging/Agent/Protocol.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ import Simplex.Messaging.Protocol
234234
NMsgMeta,
235235
ProtocolServer (..),
236236
QueueMode (..),
237+
ServiceSub,
238+
ServiceSubResult,
237239
SMPClientVersion,
238240
SMPServer,
239241
SMPServerWithAuth,
@@ -388,6 +390,9 @@ data AEvent (e :: AEntity) where
388390
DISCONNECT :: AProtocolType -> TransportHost -> AEvent AENone
389391
DOWN :: SMPServer -> [ConnId] -> AEvent AENone
390392
UP :: SMPServer -> [ConnId] -> AEvent AENone
393+
SERVICE_ALL :: SMPServer -> AEvent AENone -- all service messages are delivered
394+
SERVICE_DOWN :: SMPServer -> ServiceSub -> AEvent AENone
395+
SERVICE_UP :: SMPServer -> ServiceSubResult -> AEvent AENone
391396
SWITCH :: QueueDirection -> SwitchPhase -> ConnectionStats -> AEvent AEConn
392397
RSYNC :: RatchetSyncState -> Maybe AgentCryptoError -> ConnectionStats -> AEvent AEConn
393398
SENT :: AgentMsgId -> Maybe SMPServer -> AEvent AEConn
@@ -459,6 +464,9 @@ data AEventTag (e :: AEntity) where
459464
DISCONNECT_ :: AEventTag AENone
460465
DOWN_ :: AEventTag AENone
461466
UP_ :: AEventTag AENone
467+
SERVICE_ALL_ :: AEventTag AENone
468+
SERVICE_DOWN_ :: AEventTag AENone
469+
SERVICE_UP_ :: AEventTag AENone
462470
SWITCH_ :: AEventTag AEConn
463471
RSYNC_ :: AEventTag AEConn
464472
SENT_ :: AEventTag AEConn
@@ -514,6 +522,9 @@ aEventTag = \case
514522
DISCONNECT {} -> DISCONNECT_
515523
DOWN {} -> DOWN_
516524
UP {} -> UP_
525+
SERVICE_ALL _ -> SERVICE_ALL_
526+
SERVICE_DOWN {} -> SERVICE_DOWN_
527+
SERVICE_UP {} -> SERVICE_UP_
517528
SWITCH {} -> SWITCH_
518529
RSYNC {} -> RSYNC_
519530
SENT {} -> SENT_

0 commit comments

Comments
 (0)