mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-17 08:05:23 +00:00
wip
This commit is contained in:
@@ -1477,9 +1477,10 @@ processChatCommand cxt nm = \case
|
||||
pure $ CRServiceReplyAccepted user (AgentConnId connId)
|
||||
APIRejectServiceRequest userId requestId reason -> withUserId userId $ \user -> do
|
||||
let AgentInvId invId = requestId
|
||||
-- a reason is required for the requester to fail fast; without it the request is
|
||||
-- dropped silently and the caller waits out its timeout
|
||||
withAgent $ \a -> rejectServiceRequest a NRMInteractive (aUserId user) invId (encodeUtf8 <$> reason)
|
||||
-- A reason is required for the requester to fail fast; without it the request is dropped
|
||||
-- silently and the caller waits out its timeout. Async, so a service shedding load does
|
||||
-- not block on a network round trip per rejected request.
|
||||
withAgent $ \a -> rejectServiceRequestAsync a "" (aUserId user) invId (encodeUtf8 <$> reason)
|
||||
ok user
|
||||
APISendCallInvitation contactId callType -> withUser $ \user -> do
|
||||
-- party initiating call
|
||||
|
||||
@@ -1368,8 +1368,10 @@ processAgentMessageConn cxt user@User {userId} corrId agentConnId agentMessage =
|
||||
chatReadVar processServiceRequests >>= \case
|
||||
True -> case J.eitherDecodeStrict' =<< decompressServiceBody payload of
|
||||
Right request -> toView $ CEvtServiceRequest user (AgentInvId invId) sigKey_ request
|
||||
Left _ -> dropSReq
|
||||
False -> dropSReq
|
||||
Left e -> logError ("service request dropped, invalid payload: " <> tshow e) >> dropSReq
|
||||
-- the requester gets no reply and waits out its timeout, so this must be visible
|
||||
-- to whoever deployed the service without enabling service requests
|
||||
False -> logError "service request dropped: service requests are not enabled" >> dropSReq
|
||||
where
|
||||
dropSReq = withAgent $ \a -> rejectServiceRequest a NRMBackground (aUserId user) invId Nothing
|
||||
LINK _link auData ->
|
||||
|
||||
Reference in New Issue
Block a user