Skip to content

Commit 927c973

Browse files
committed
server: support server roles and operators
1 parent a957693 commit 927c973

File tree

5 files changed

+127
-53
lines changed

5 files changed

+127
-53
lines changed

src/Simplex/FileTransfer/Agent.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,14 @@ runXFTPSndPrepareWorker c Worker {doWork} = do
461461
pure srv
462462
where
463463
tryCreate = do
464-
usedSrvs <- newTVarIO ([] :: [XFTPServer])
464+
triedHosts <- newTVarIO S.empty
465465
let AgentClient {xftpServers} = c
466466
userSrvCount <- liftIO $ length <$> TM.lookupIO userId xftpServers
467467
withRetryIntervalCount (riFast ri) $ \n _ loop -> do
468468
liftIO $ waitWhileSuspended c
469469
liftIO $ waitForUserNetwork c
470470
let triedAllSrvs = n > userSrvCount
471-
createWithNextSrv usedSrvs
471+
createWithNextSrv triedHosts
472472
`catchAgentError` \e -> retryOnError "XFTP prepare worker" (retryLoop loop triedAllSrvs e) (throwE e) e
473473
where
474474
-- we don't do closeXFTPServerClient here to not risk closing connection for concurrent chunk upload
@@ -477,10 +477,10 @@ runXFTPSndPrepareWorker c Worker {doWork} = do
477477
when (triedAllSrvs && serverHostError e) $ notify c sndFileEntityId $ SFWARN e
478478
liftIO $ assertAgentForeground c
479479
loop
480-
createWithNextSrv usedSrvs = do
480+
createWithNextSrv triedHosts = do
481481
deleted <- withStore' c $ \db -> getSndFileDeleted db sndFileId
482482
when deleted $ throwE $ FILE NO_FILE
483-
withNextSrv c userId usedSrvs [] $ \srvAuth -> do
483+
withNextSrv c userId storageSrvs triedHosts [] $ \srvAuth -> do
484484
replica <- agentXFTPNewChunk c ch numRecipients' srvAuth
485485
pure (replica, srvAuth)
486486

src/Simplex/Messaging/Agent.hs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -811,8 +811,8 @@ joinConn :: AgentClient -> UserId -> ConnId -> Bool -> Bool -> ConnectionRequest
811811
joinConn c userId connId hasNewConn enableNtfs cReq cInfo pqSupport subMode = do
812812
srv <- case cReq of
813813
CRInvitationUri ConnReqUriData {crSmpQueues = q :| _} _ ->
814-
getNextServer c userId [qServer q]
815-
_ -> getSMPServer c userId
814+
getNextSMPServer c userId [qServer q]
815+
_ -> getSMPServer c userId -- TODO when connecting to contact address, also try gettings a different operator/server
816816
joinConnSrv c userId connId hasNewConn enableNtfs cReq cInfo pqSupport subMode srv
817817

818818
startJoinInvitation :: UserId -> ConnId -> Maybe SndQueue -> Bool -> ConnectionRequestUri 'CMInvitation -> PQSupport -> AM (ConnData, NewSndQueue, C.PublicKeyX25519, CR.Ratchet 'C.X448, CR.SndE2ERatchetParams 'C.X448)
@@ -1169,14 +1169,13 @@ runCommandProcessing c@AgentClient {subQ} connId server_ Worker {doWork} = do
11691169
processCmd ri PendingCommand {cmdId, corrId, userId, command} pendingCmds = case command of
11701170
AClientCommand cmd -> case cmd of
11711171
NEW enableNtfs (ACM cMode) pqEnc subMode -> noServer $ do
1172-
usedSrvs <- newTVarIO ([] :: [SMPServer])
1173-
tryCommand . withNextSrv c userId usedSrvs [] $ \srv -> do
1172+
triedHosts <- newTVarIO S.empty
1173+
tryCommand . withNextSrv c userId storageSrvs triedHosts [] $ \srv -> do
11741174
(_, cReq) <- newRcvConnSrv c userId connId enableNtfs cMode Nothing pqEnc subMode srv
11751175
notify $ INV (ACR cMode cReq)
11761176
JOIN enableNtfs (ACR _ cReq@(CRInvitationUri ConnReqUriData {crSmpQueues = q :| _} _)) pqEnc subMode connInfo -> noServer $ do
1177-
let initUsed = [qServer q]
1178-
usedSrvs <- newTVarIO initUsed
1179-
tryCommand . withNextSrv c userId usedSrvs initUsed $ \srv -> do
1177+
triedHosts <- newTVarIO S.empty
1178+
tryCommand . withNextSrv c userId storageSrvs triedHosts [qServer q] $ \srv -> do
11801179
sqSecured <- joinConnSrvAsync c userId connId enableNtfs cReq connInfo pqEnc subMode srv
11811180
notify $ JOINED sqSecured
11821181
LET confId ownCInfo -> withServer' . tryCommand $ allowConnection' c connId confId ownCInfo >> notify OK
@@ -1624,8 +1623,8 @@ switchDuplexConnection c (DuplexConnection cData@ConnData {connId, userId} rqs s
16241623
checkRQSwchStatus rq RSSwitchStarted
16251624
clientVRange <- asks $ smpClientVRange . config
16261625
-- try to get the server that is different from all queues, or at least from the primary rcv queue
1627-
srvAuth@(ProtoServerWithAuth srv _) <- getNextServer c userId $ map qServer (L.toList rqs) <> map qServer (L.toList sqs)
1628-
srv' <- if srv == server then getNextServer c userId [server] else pure srvAuth
1626+
srvAuth@(ProtoServerWithAuth srv _) <- getNextSMPServer c userId $ map qServer (L.toList rqs) <> map qServer (L.toList sqs)
1627+
srv' <- if srv == server then getNextSMPServer c userId [server] else pure srvAuth
16291628
(q, qUri, tSess, sessId) <- newRcvQueue c userId connId srv' clientVRange SMSubscribe False
16301629
let rq' = (q :: NewRcvQueue) {primary = True, dbReplaceQueueId = Just dbQueueId}
16311630
rq'' <- withStore c $ \db -> addConnRcvQueue db connId rq'
@@ -2144,9 +2143,13 @@ debugAgentLocks AgentClient {connLocks = cs, invLocks = is, deleteLock = d} = do
21442143
getLocks ls = atomically $ M.mapKeys (B.unpack . strEncode) . M.mapMaybe id <$> (mapM tryReadTMVar =<< readTVar ls)
21452144

21462145
getSMPServer :: AgentClient -> UserId -> AM SMPServerWithAuth
2147-
getSMPServer c userId = withUserServers c userId pickServer
2146+
getSMPServer c userId = getNextSMPServer c userId []
21482147
{-# INLINE getSMPServer #-}
21492148

2149+
getNextSMPServer :: AgentClient -> UserId -> [SMPServer] -> AM SMPServerWithAuth
2150+
getNextSMPServer c userId = getNextServer c userId storageSrvs
2151+
{-# INLINE getNextSMPServer #-}
2152+
21502153
subscriber :: AgentClient -> AM' ()
21512154
subscriber c@AgentClient {msgQ} = forever $ do
21522155
t <- atomically $ readTBQueue msgQ

src/Simplex/Messaging/Agent/Client.hs

Lines changed: 73 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ module Simplex.Messaging.Agent.Client
147147
userServers,
148148
pickServer,
149149
getNextServer,
150-
withUserServers,
151150
withNextSrv,
152151
incSMPServerStat,
153152
incSMPServerStat',
@@ -191,12 +190,12 @@ import qualified Data.ByteString.Char8 as B
191190
import Data.Either (isRight, partitionEithers)
192191
import Data.Functor (($>))
193192
import Data.Int (Int64)
194-
import Data.List (deleteFirstsBy, find, foldl', partition, (\\))
193+
import Data.List (find, foldl', partition)
195194
import Data.List.NonEmpty (NonEmpty (..), (<|))
196195
import qualified Data.List.NonEmpty as L
197196
import Data.Map.Strict (Map)
198197
import qualified Data.Map.Strict as M
199-
import Data.Maybe (catMaybes, fromMaybe, isJust, isNothing, listToMaybe)
198+
import Data.Maybe (catMaybes, fromMaybe, isJust, isNothing, listToMaybe, mapMaybe)
200199
import Data.Set (Set)
201200
import qualified Data.Set as S
202201
import Data.Text (Text)
@@ -262,7 +261,6 @@ import Simplex.Messaging.Protocol
262261
VersionSMPC,
263262
XFTPServer,
264263
XFTPServerWithAuth,
265-
sameSrvAddr',
266264
pattern NoEntity,
267265
)
268266
import qualified Simplex.Messaging.Protocol as SMP
@@ -617,7 +615,7 @@ getSMPServerClient c@AgentClient {active, smpClients, workerSeq} tSess = do
617615
getSMPProxyClient :: AgentClient -> Maybe SMPServerWithAuth -> SMPTransportSession -> AM (SMPConnectedClient, Either AgentErrorType ProxiedRelay)
618616
getSMPProxyClient c@AgentClient {active, smpClients, smpProxiedRelays, workerSeq} proxySrv_ destSess@(userId, destSrv, qId) = do
619617
unlessM (readTVarIO active) $ throwE INACTIVE
620-
proxySrv <- maybe (getNextServer c userId [destSrv]) pure proxySrv_
618+
proxySrv <- maybe (getNextServer c userId proxySrvs [destSrv]) pure proxySrv_
621619
ts <- liftIO getCurrentTime
622620
atomically (getClientVar proxySrv ts) >>= \(tSess, auth, v) ->
623621
either (newProxyClient tSess auth ts) (waitForProxyClient tSess auth) v
@@ -1072,7 +1070,7 @@ sendOrProxySMPCommand ::
10721070
(SMPClient -> ProxiedRelay -> ExceptT SMPClientError IO (Either ProxyClientError ())) ->
10731071
(SMPClient -> ExceptT SMPClientError IO ()) ->
10741072
AM (Maybe SMPServer)
1075-
sendOrProxySMPCommand c userId destSrv connId cmdStr senderId sendCmdViaProxy sendCmdDirectly = do
1073+
sendOrProxySMPCommand c userId destSrv@ProtocolServer {host = destHosts} connId cmdStr senderId sendCmdViaProxy sendCmdDirectly = do
10761074
tSess <- mkTransportSession c userId destSrv connId
10771075
ifM shouldUseProxy (sendViaProxy Nothing tSess) (sendDirectly tSess $> Nothing)
10781076
where
@@ -1091,7 +1089,7 @@ sendOrProxySMPCommand c userId destSrv connId cmdStr senderId sendCmdViaProxy se
10911089
SPFAllow -> True
10921090
SPFAllowProtected -> ipAddressProtected cfg destSrv
10931091
SPFProhibit -> False
1094-
unknownServer = liftIO $ maybe True (notElem destSrv . knownSrvs) <$> TM.lookupIO userId (smpServers c)
1092+
unknownServer = liftIO $ maybe True (\srvs -> all (`S.notMember` knownHosts srvs) destHosts) <$> TM.lookupIO userId (smpServers c)
10951093
sendViaProxy :: Maybe SMPServerWithAuth -> SMPTransportSession -> AM (Maybe SMPServer)
10961094
sendViaProxy proxySrv_ destSess@(_, _, connId_) = do
10971095
r <- tryAgentError . withProxySession c proxySrv_ destSess senderId ("PFWD " <> cmdStr) $ \(SMPConnectedClient smp _, proxySess@ProxiedRelay {prBasicAuth}) -> do
@@ -2033,33 +2031,82 @@ userServers c = case protocolTypeI @p of
20332031
SPXFTP -> xftpServers c
20342032
{-# INLINE userServers #-}
20352033

2036-
pickServer :: forall p. NonEmpty (ProtoServerWithAuth p) -> AM (ProtoServerWithAuth p)
2034+
pickServer :: NonEmpty (OperatorId, ProtoServerWithAuth p) -> AM (ProtoServerWithAuth p)
20372035
pickServer = \case
2038-
srv :| [] -> pure srv
2036+
(_, srv) :| [] -> pure srv
20392037
servers -> do
20402038
gen <- asks randomServer
2041-
atomically $ (servers L.!!) <$> stateTVar gen (randomR (0, L.length servers - 1))
2039+
atomically $ snd . (servers L.!!) <$> stateTVar gen (randomR (0, L.length servers - 1))
20422040

2043-
getNextServer :: forall p. (ProtocolTypeI p, UserProtocol p) => AgentClient -> UserId -> [ProtocolServer p] -> AM (ProtoServerWithAuth p)
2044-
getNextServer c userId usedSrvs = withUserServers c userId $ \srvs ->
2045-
case L.nonEmpty $ deleteFirstsBy sameSrvAddr' (L.toList srvs) (map noAuthSrv usedSrvs) of
2046-
Just srvs' -> pickServer srvs'
2047-
_ -> pickServer srvs
2041+
getNextServer ::
2042+
(ProtocolTypeI p, UserProtocol p) =>
2043+
AgentClient ->
2044+
UserId ->
2045+
(UserServers p -> NonEmpty (OperatorId, ProtoServerWithAuth p)) ->
2046+
[ProtocolServer p] ->
2047+
AM (ProtoServerWithAuth p)
2048+
getNextServer c userId srvsSel usedSrvs = do
2049+
srvs <- getUserServers_ c userId srvsSel
2050+
snd <$> getNextServer_ srvs (usedOperatorsHosts srvs usedSrvs)
2051+
2052+
usedOperatorsHosts :: NonEmpty (OperatorId, ProtoServerWithAuth p) -> [ProtocolServer p] -> (Set OperatorId, Set TransportHost)
2053+
usedOperatorsHosts srvs usedSrvs = (usedOperators, usedHosts)
2054+
where
2055+
usedHosts = S.unions $ map serverHosts usedSrvs
2056+
usedOperators = S.fromList $ mapMaybe usedOp $ L.toList srvs
2057+
usedOp (op, srv) = if hasUsedHost srv then Just op else Nothing
2058+
hasUsedHost (ProtoServerWithAuth srv _) = any (`S.member` usedHosts) $ serverHosts srv
2059+
2060+
getNextServer_ ::
2061+
(ProtocolTypeI p, UserProtocol p) =>
2062+
NonEmpty (OperatorId, ProtoServerWithAuth p) ->
2063+
(Set OperatorId, Set TransportHost) ->
2064+
AM (NonEmpty (OperatorId, ProtoServerWithAuth p), ProtoServerWithAuth p)
2065+
getNextServer_ servers (usedOperators, usedHosts) = do
2066+
-- choose from servers of unused operators, when possible
2067+
let otherOpsSrvs = filterOrAll ((`S.notMember` usedOperators) . fst) servers
2068+
-- choose from servers with unused hosts when possible
2069+
unusedSrvs = filterOrAll (isUnusedServer usedHosts) otherOpsSrvs
2070+
(otherOpsSrvs,) <$> pickServer unusedSrvs
2071+
where
2072+
filterOrAll p srvs = fromMaybe srvs $ L.nonEmpty $ L.filter p srvs
2073+
2074+
isUnusedServer :: Set TransportHost -> (OperatorId, ProtoServerWithAuth p) -> Bool
2075+
isUnusedServer usedHosts (_, ProtoServerWithAuth ProtocolServer {host} _) = all (`S.notMember` usedHosts) host
20482076

2049-
withUserServers :: forall p a. (ProtocolTypeI p, UserProtocol p) => AgentClient -> UserId -> (NonEmpty (ProtoServerWithAuth p) -> AM a) -> AM a
2050-
withUserServers c userId action =
2077+
getUserServers_ ::
2078+
(ProtocolTypeI p, UserProtocol p) =>
2079+
AgentClient ->
2080+
UserId ->
2081+
(UserServers p -> NonEmpty (OperatorId, ProtoServerWithAuth p)) ->
2082+
AM (NonEmpty (OperatorId, ProtoServerWithAuth p))
2083+
getUserServers_ c userId srvsSel =
20512084
liftIO (TM.lookupIO userId $ userServers c) >>= \case
2052-
Just srvs -> action $ enabledSrvs srvs
2085+
Just srvs -> pure $ srvsSel srvs
20532086
_ -> throwE $ INTERNAL "unknown userId - no user servers"
20542087

2055-
withNextSrv :: forall p a. (ProtocolTypeI p, UserProtocol p) => AgentClient -> UserId -> TVar [ProtocolServer p] -> [ProtocolServer p] -> (ProtoServerWithAuth p -> AM a) -> AM a
2056-
withNextSrv c userId usedSrvs initUsed action = do
2057-
used <- readTVarIO usedSrvs
2058-
srvAuth@(ProtoServerWithAuth srv _) <- getNextServer c userId used
2059-
srvs_ <- liftIO $ TM.lookupIO userId $ userServers c
2060-
let unused = maybe [] ((\\ used) . map protoServer . L.toList . enabledSrvs) srvs_
2061-
used' = if null unused then initUsed else srv : used
2062-
atomically $ writeTVar usedSrvs $! used'
2088+
-- This function checks used servers and operators every time to allow
2089+
-- changing configuration while retry look is executing.
2090+
-- This function is not thread safe.
2091+
withNextSrv ::
2092+
(ProtocolTypeI p, UserProtocol p) =>
2093+
AgentClient ->
2094+
UserId ->
2095+
(UserServers p -> NonEmpty (OperatorId, ProtoServerWithAuth p)) ->
2096+
TVar (Set TransportHost) ->
2097+
[ProtocolServer p] ->
2098+
(ProtoServerWithAuth p -> AM a) ->
2099+
AM a
2100+
withNextSrv c userId srvsSel triedHosts usedSrvs action = do
2101+
srvs <- getUserServers_ c userId srvsSel
2102+
let (usedOperators, usedHosts) = usedOperatorsHosts srvs usedSrvs
2103+
tried <- readTVarIO triedHosts
2104+
let triedOrUsed = S.union tried usedHosts
2105+
(otherOpsSrvs, srvAuth@(ProtoServerWithAuth srv _)) <- getNextServer_ srvs (usedOperators, triedOrUsed)
2106+
let newHosts = serverHosts srv
2107+
unusedSrvs = L.filter (isUnusedServer $ S.union triedOrUsed newHosts) otherOpsSrvs
2108+
!tried' = if null unusedSrvs then S.empty else S.union tried newHosts
2109+
atomically $ writeTVar triedHosts tried'
20632110
action srvAuth
20642111

20652112
incSMPServerStat :: AgentClient -> UserId -> SMPServer -> (AgentSMPServerStats -> TVar Int) -> STM ()

src/Simplex/Messaging/Agent/Env/SQLite.hs

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ module Simplex.Messaging.Agent.Env.SQLite
1717
AgentConfig (..),
1818
InitialAgentServers (..),
1919
ServerCfg (..),
20+
ServerRoles (..),
21+
OperatorId,
2022
UserServers (..),
2123
NetworkConfig (..),
2224
presetServerCfg,
2325
enabledServerCfg,
2426
mkUserServers,
27+
serverHosts,
2528
defaultAgentConfig,
2629
defaultReconnectInterval,
2730
tryAgentError,
@@ -54,6 +57,8 @@ import Data.List.NonEmpty (NonEmpty)
5457
import qualified Data.List.NonEmpty as L
5558
import Data.Map.Strict (Map)
5659
import Data.Maybe (fromMaybe)
60+
import Data.Set (Set)
61+
import qualified Data.Set as S
5762
import Data.Time.Clock (NominalDiffTime, nominalDay)
5863
import Data.Time.Clock.System (SystemTime (..))
5964
import Data.Word (Word16)
@@ -71,10 +76,11 @@ import Simplex.Messaging.Notifications.Client (defaultNTFClientConfig)
7176
import Simplex.Messaging.Notifications.Transport (NTFVersion)
7277
import Simplex.Messaging.Notifications.Types
7378
import Simplex.Messaging.Parsers (defaultJSON)
74-
import Simplex.Messaging.Protocol (NtfServer, ProtoServerWithAuth, ProtocolServer, ProtocolType (..), ProtocolTypeI, VersionRangeSMPC, XFTPServer, supportedSMPClientVRange)
79+
import Simplex.Messaging.Protocol (NtfServer, ProtoServerWithAuth (..), ProtocolServer (..), ProtocolType (..), ProtocolTypeI, VersionRangeSMPC, XFTPServer, supportedSMPClientVRange)
7580
import Simplex.Messaging.TMap (TMap)
7681
import qualified Simplex.Messaging.TMap as TM
7782
import Simplex.Messaging.Transport (SMPVersion)
83+
import Simplex.Messaging.Transport.Client (TransportHost)
7884
import Simplex.Messaging.Util (allFinally, catchAllErrors, catchAllErrors', tryAllErrors, tryAllErrors')
7985
import System.Mem.Weak (Weak)
8086
import System.Random (StdGen, newStdGen)
@@ -94,29 +100,45 @@ data InitialAgentServers = InitialAgentServers
94100

95101
data ServerCfg p = ServerCfg
96102
{ server :: ProtoServerWithAuth p,
103+
operator :: OperatorId,
97104
preset :: Bool,
98105
tested :: Maybe Bool,
99-
enabled :: Bool
106+
enabled :: Bool,
107+
roles :: ServerRoles
100108
}
101109
deriving (Show)
102110

103-
enabledServerCfg :: ProtoServerWithAuth p -> ServerCfg p
104-
enabledServerCfg server = ServerCfg {server, preset = False, tested = Nothing, enabled = True}
111+
data ServerRoles = ServerRoles
112+
{ storage :: Bool,
113+
proxy :: Bool
114+
}
115+
deriving (Show)
116+
117+
enabledServerCfg :: OperatorId -> ProtoServerWithAuth p -> ServerCfg p
118+
enabledServerCfg operator server =
119+
ServerCfg {server, operator, preset = False, tested = Nothing, enabled = True, roles = ServerRoles True True}
105120

106-
presetServerCfg :: Bool -> ProtoServerWithAuth p -> ServerCfg p
107-
presetServerCfg enabled server = ServerCfg {server, preset = True, tested = Nothing, enabled}
121+
presetServerCfg :: Bool -> ServerRoles -> OperatorId -> ProtoServerWithAuth p -> ServerCfg p
122+
presetServerCfg enabled roles operator server =
123+
ServerCfg {server, operator, preset = True, tested = Nothing, enabled, roles}
108124

109125
data UserServers p = UserServers
110-
{ enabledSrvs :: NonEmpty (ProtoServerWithAuth p),
111-
knownSrvs :: NonEmpty (ProtocolServer p)
126+
{ storageSrvs :: NonEmpty (OperatorId, ProtoServerWithAuth p),
127+
proxySrvs :: NonEmpty (OperatorId, ProtoServerWithAuth p),
128+
knownHosts :: Set TransportHost
112129
}
113130

131+
type OperatorId = Int64
132+
114133
-- This function sets all servers as enabled in case all passed servers are disabled.
115134
mkUserServers :: NonEmpty (ServerCfg p) -> UserServers p
116-
mkUserServers srvs = UserServers {enabledSrvs, knownSrvs}
135+
mkUserServers srvs = UserServers {storageSrvs = filterSrvs storage, proxySrvs = filterSrvs proxy, knownHosts}
117136
where
118-
enabledSrvs = L.map (\ServerCfg {server} -> server) $ fromMaybe srvs $ L.nonEmpty $ L.filter (\ServerCfg {enabled} -> enabled) srvs
119-
knownSrvs = L.map (\ServerCfg {server = ProtoServerWithAuth srv _} -> srv) srvs
137+
filterSrvs role = L.map (\ServerCfg {operator, server} -> (operator, server)) $ fromMaybe srvs $ L.nonEmpty $ L.filter (\ServerCfg {enabled, roles} -> enabled && role roles) srvs
138+
knownHosts = S.unions $ L.map (\ServerCfg {server = ProtoServerWithAuth srv _} -> serverHosts srv) srvs
139+
140+
serverHosts :: ProtocolServer p -> Set TransportHost
141+
serverHosts ProtocolServer {host} = S.fromList $ L.toList host
120142

121143
data AgentConfig = AgentConfig
122144
{ tcpPort :: Maybe ServiceName,
@@ -333,6 +355,8 @@ updateRestartCount t (RestartCount minute count) = do
333355

334356
$(pure [])
335357

358+
$(JQ.deriveJSON defaultJSON ''ServerRoles)
359+
336360
instance ProtocolTypeI p => ToJSON (ServerCfg p) where
337361
toEncoding = $(JQ.mkToEncoding defaultJSON ''ServerCfg)
338362
toJSON = $(JQ.mkToJSON defaultJSON ''ServerCfg)

tests/SMPAgentClient.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ userServers :: NonEmpty (ProtocolServer p) -> Map UserId (NonEmpty (ServerCfg p)
9292
userServers = userServers' . L.map noAuthSrv
9393

9494
userServers' :: NonEmpty (ProtoServerWithAuth p) -> Map UserId (NonEmpty (ServerCfg p))
95-
userServers' srvs = M.fromList [(1, L.map (presetServerCfg True) srvs)]
95+
userServers' srvs = M.fromList [(1, L.map (presetServerCfg True (ServerRoles True True) 1) srvs)]
9696

9797
noAuthSrvCfg :: ProtocolServer p -> ServerCfg p
98-
noAuthSrvCfg = presetServerCfg True . noAuthSrv
98+
noAuthSrvCfg = presetServerCfg True (ServerRoles True True) 1 . noAuthSrv

0 commit comments

Comments
 (0)