mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-04 23:21:55 +00:00
core: update remote host session state, terminate TLS in one more case (#3364)
* core: update remote host session state, terminate TLS in one more case * name
This commit is contained in:
committed by
GitHub
parent
598b6659cc
commit
c91625b32a
@@ -3,6 +3,7 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DuplicateRecordFields #-}
|
||||
{-# LANGUAGE GADTs #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE NamedFieldPuns #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
@@ -63,7 +64,8 @@ data RHPendingSession = RHPendingSession
|
||||
|
||||
data RemoteHostSession
|
||||
= RHSessionStarting
|
||||
| RHSessionConnecting {rhPendingSession :: RHPendingSession}
|
||||
| RHSessionConnecting {invitation :: Text, rhPendingSession :: RHPendingSession}
|
||||
| RHSessionPendingConfirmation {sessionCode :: Text, tls :: TLS, rhPendingSession :: RHPendingSession}
|
||||
| RHSessionConfirmed {tls :: TLS, rhPendingSession :: RHPendingSession}
|
||||
| RHSessionConnected
|
||||
{ rchClient :: RCHostClient,
|
||||
@@ -73,6 +75,22 @@ data RemoteHostSession
|
||||
storePath :: FilePath
|
||||
}
|
||||
|
||||
data RemoteHostSessionState
|
||||
= RHSStarting
|
||||
| RHSConnecting {invitation :: Text}
|
||||
| RHSPendingConfirmation {sessionCode :: Text}
|
||||
| RHSConfirmed
|
||||
| RHSConnected
|
||||
deriving (Show)
|
||||
|
||||
rhsSessionState :: RemoteHostSession -> RemoteHostSessionState
|
||||
rhsSessionState = \case
|
||||
RHSessionStarting -> RHSStarting
|
||||
RHSessionConnecting {invitation} -> RHSConnecting {invitation}
|
||||
RHSessionPendingConfirmation {sessionCode} -> RHSPendingConfirmation {sessionCode}
|
||||
RHSessionConfirmed {} -> RHSConfirmed
|
||||
RHSessionConnected {} -> RHSConnected
|
||||
|
||||
data RemoteProtocolError
|
||||
= -- | size prefix is malformed
|
||||
RPEInvalidSize
|
||||
@@ -112,7 +130,7 @@ data RemoteHostInfo = RemoteHostInfo
|
||||
{ remoteHostId :: RemoteHostId,
|
||||
hostDeviceName :: Text,
|
||||
storePath :: FilePath,
|
||||
sessionActive :: Bool
|
||||
sessionState :: Maybe RemoteHostSessionState
|
||||
}
|
||||
deriving (Show)
|
||||
|
||||
@@ -174,6 +192,8 @@ $(J.deriveJSON (sumTypeJSON $ dropPrefix "RH") ''RHKey)
|
||||
|
||||
$(J.deriveJSON (enumJSON $ dropPrefix "PE") ''PlatformEncoding)
|
||||
|
||||
$(J.deriveJSON (sumTypeJSON $ dropPrefix "RHS") ''RemoteHostSessionState)
|
||||
|
||||
$(J.deriveJSON defaultJSON ''RemoteHostInfo)
|
||||
|
||||
$(J.deriveJSON defaultJSON ''RemoteCtrlInfo)
|
||||
|
||||
Reference in New Issue
Block a user