diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2020-05-10 23:30:59 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2020-05-11 23:13:40 +0200 |
commit | b08e5a3e6d82ca5e5a2e29e791a2e61bf08964a4 (patch) | |
tree | 59b122e5f04de61d9069f72309f6ba7d524cff97 /src/Main.hs | |
parent | fd633795d755049c528d6594e6645fd15a1c57e6 (diff) |
Network: support adding custom peers
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Main.hs b/src/Main.hs index 0398233..34c2b3b 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -96,7 +96,7 @@ interactiveLoop st bhost = runInputT defaultSettings $ do False -> error "Requires terminal" extPrint <- getExternalPrint let extPrintLn str = extPrint $ str ++ "\n"; - chanPeer <- liftIO $ do + server <- liftIO $ do erebosHead <- loadLocalStateHead st startServer erebosHead extPrintLn bhost [ SomeService @AttachService Proxy @@ -107,7 +107,7 @@ interactiveLoop st bhost = runInputT defaultSettings $ do peers <- liftIO $ newMVar [] void $ liftIO $ forkIO $ void $ forever $ do - peer <- readChan chanPeer + peer <- readChan $ serverChanPeer server if | PeerIdentityFull pid <- peerIdentity peer -> do let update [] = ([peer], Nothing) update (p:ps) | PeerIdentityFull pid' <- peerIdentity p @@ -142,6 +142,7 @@ interactiveLoop st bhost = runInputT defaultSettings $ do curIdentity <- liftIO $ loadLocalIdentity st res <- liftIO $ runExceptT $ flip execStateT cstate $ runReaderT cmd CommandInput { ciSelf = curIdentity + , ciServer = server , ciLine = line , ciPrint = extPrintLn , ciPeers = liftIO $ readMVar peers @@ -158,6 +159,7 @@ interactiveLoop st bhost = runInputT defaultSettings $ do data CommandInput = CommandInput { ciSelf :: UnifiedIdentity + , ciServer :: Server , ciLine :: String , ciPrint :: String -> IO () , ciPeers :: CommandM [Peer] |