Skip to content

Commit 1b72fb8

Browse files
committed
add data to LINK
1 parent ad9880b commit 1b72fb8

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/Simplex/Messaging/Agent.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,10 +1673,10 @@ runCommandProcessing c@AgentClient {subQ} connId server_ Worker {doWork} = do
16731673
tryCommand . withNextSrv c userId storageSrvs triedHosts [] $ \srv -> do
16741674
(CCLink cReq _, service) <- newRcvConnSrv c NRMBackground userId connId enableNtfs cMode Nothing Nothing pqEnc subMode srv
16751675
notify $ INV (ACR cMode cReq) service
1676-
LSET (AUCLD cMode userLinkData) clientData ->
1676+
LSET auData@(AUCLD cMode userLinkData) clientData ->
16771677
withServer' . tryCommand $ do
16781678
link <- setConnShortLink' c NRMBackground connId cMode userLinkData clientData
1679-
notify $ LINK (ACSL cMode link)
1679+
notify $ LINK (ACSL cMode link) auData
16801680
JOIN enableNtfs (ACR _ cReq@(CRInvitationUri ConnReqUriData {crSmpQueues = q :| _} _)) pqEnc subMode connInfo -> noServer $ do
16811681
triedHosts <- newTVarIO S.empty
16821682
tryCommand . withNextSrv c userId storageSrvs triedHosts [qServer q] $ \srv -> do

src/Simplex/Messaging/Agent/Protocol.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ type SndQueueSecured = Bool
383383
-- | Parameterized type for SMP agent events
384384
data AEvent (e :: AEntity) where
385385
INV :: AConnectionRequestUri -> Maybe ClientServiceId -> AEvent AEConn
386-
LINK :: AConnShortLink -> AEvent AEConn
386+
LINK :: AConnShortLink -> AUserConnLinkData -> AEvent AEConn
387387
CONF :: ConfirmationId -> PQSupport -> [SMPServer] -> ConnInfo -> AEvent AEConn -- ConnInfo is from sender, [SMPServer] will be empty only in v1 handshake
388388
REQ :: InvitationId -> PQSupport -> NonEmpty SMPServer -> ConnInfo -> AEvent AEConn -- ConnInfo is from sender
389389
INFO :: PQSupport -> ConnInfo -> AEvent AEConn
@@ -514,7 +514,7 @@ aCommandTag = \case
514514
aEventTag :: AEvent e -> AEventTag e
515515
aEventTag = \case
516516
INV {} -> INV_
517-
LINK _ -> LINK_
517+
LINK {} -> LINK_
518518
CONF {} -> CONF_
519519
REQ {} -> REQ_
520520
INFO {} -> INFO_

tests/AgentTests/FunctionalAPITests.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,12 +2644,13 @@ testSetConnShortLinkAsync ps = withAgentClients2 $ \alice bob ->
26442644
let updatedData = UserLinkData "updated user data"
26452645
updatedCtData = UserContactData {direct = False, owners = [], relays = [], userData = updatedData}
26462646
setConnShortLinkAsync alice "1" cId SCMContact (UserContactLinkData updatedCtData) Nothing
2647-
("1", cId', LINK (ACSL SCMContact shortLink')) <- get alice
2647+
("1", cId', LINK (ACSL SCMContact shortLink') (AUCLD SCMContact (UserContactLinkData updatedCtData'))) <- get alice
26482648
liftIO $ cId' `shouldBe` cId
26492649
liftIO $ shortLink' `shouldBe` shortLink
2650-
-- verify updated link data
2651-
(_, ContactLinkData _ updatedCtData') <- getConnShortLink bob 1 shortLink'
26522650
liftIO $ updatedCtData' `shouldBe` updatedCtData
2651+
-- verify updated link data
2652+
(_, ContactLinkData _ updatedCtData'') <- getConnShortLink bob 1 shortLink'
2653+
liftIO $ updatedCtData'' `shouldBe` updatedCtData
26532654
-- complete connection via contact address
26542655
(aliceId, _) <- joinConnection bob 1 True qInfo "bob's connInfo" SMSubscribe
26552656
("", _, REQ invId _ "bob's connInfo") <- get alice

0 commit comments

Comments
 (0)