diff --git a/src/Simplex/RemoteControl/Client.hs b/src/Simplex/RemoteControl/Client.hs index bf0f3780d..2b488de2a 100644 --- a/src/Simplex/RemoteControl/Client.hs +++ b/src/Simplex/RemoteControl/Client.hs @@ -226,7 +226,7 @@ data RCCClient_ = RCCClient_ endSession :: TMVar () } -type RCCtrlConnection = (RCCtrlClient, RCStepTMVar (SessionCode, RCStepTMVar (RCCtrlSession, RCCtrlPairing))) +type RCCtrlConnection = (RCCtrlClient, RCStepTMVar (SessionCode, TLS, RCStepTMVar (RCCtrlSession, RCCtrlPairing))) connectRCCtrlURI :: TVar ChaChaDRG -> RCSignedInvitation -> Maybe RCCtrlPairing -> J.Value -> ExceptT RCErrorType IO RCCtrlConnection connectRCCtrlURI drg signedInv@RCSignedInvitation {invitation} pairing_ hostAppInfo = do @@ -262,7 +262,7 @@ connectRCCtrl_ drg pairing'@RCCtrlPairing {caKey, caCert} inv@RCInvitation {ca, confirmSession <- newEmptyTMVarIO endSession <- newEmptyTMVarIO pure RCCClient_ {confirmSession, endSession} - runClient :: RCCClient_ -> RCStepTMVar (SessionCode, RCStepTMVar (RCCtrlSession, RCCtrlPairing)) -> ExceptT RCErrorType IO () + runClient :: RCCClient_ -> RCStepTMVar (SessionCode, TLS, RCStepTMVar (RCCtrlSession, RCCtrlPairing)) -> ExceptT RCErrorType IO () runClient RCCClient_ {confirmSession, endSession} r = do clientCredentials <- liftIO (genTLSCredentials caKey caCert) >>= \case @@ -273,7 +273,7 @@ connectRCCtrl_ drg pairing'@RCCtrlPairing {caKey, caCert} inv@RCInvitation {ca, void . runExceptT $ do logDebug "Got TLS connection" r' <- newEmptyTMVarIO - whenM (atomically $ tryPutTMVar r $ Right (tlsUniq tls, r')) $ do + whenM (atomically $ tryPutTMVar r $ Right (tlsUniq tls, tls, r')) $ do logDebug "Waiting for session confirmation" whenM (atomically $ readTMVar confirmSession) (runSession tls r') `putRCError` r' where diff --git a/tests/RemoteControl.hs b/tests/RemoteControl.hs index cb7bec71b..26b9cdb11 100644 --- a/tests/RemoteControl.hs +++ b/tests/RemoteControl.hs @@ -46,7 +46,7 @@ testNewPairing = do logNote "h 1" (rcCtrlClient, r) <- RC.connectRCCtrlURI drg inv Nothing (J.String "app") logNote "h 2" - Right (sessId', r') <- atomically $ takeTMVar r + Right (sessId', _tls, r') <- atomically $ takeTMVar r logNote "h 3" liftIO $ RC.confirmCtrlSession rcCtrlClient True logNote "h 4" @@ -105,7 +105,7 @@ testExistingPairing = do pure hp' runHost drg cp_ inv = async . runRight $ do (rcCtrlClient, r) <- RC.connectRCCtrlURI drg inv cp_ (J.String "app") - Right (_sessId', r') <- atomically $ takeTMVar r + Right (_sessId', _tls, r') <- atomically $ takeTMVar r liftIO $ RC.confirmCtrlSession rcCtrlClient True Right (_rcCtrlSession, cp') <- atomically $ takeTMVar r' threadDelay 250000