1-- | Like Latency, but creating lots of channels
2import System.Environment
4import Control.Applicative
5import Control.Distributed.Process
6import Control.Distributed.Process.Node
7import Network.Transport.TCP (createTransport, defaultTCPAddr, defaultTCPParameters)
8import Data.Binary (encode, decode)
9import qualified Data.ByteString.Lazy as BSL
11pingServer :: Process ()
12pingServer = forever $ do
15 -- TODO: should this be automatic?
18pingClient :: Int -> ProcessId -> Process ()
21 (sc, rc) <- newChan :: Process (SendPort (), ReceivePort ())
24 liftIO . putStrLn $ "Did " ++ show n ++ " pings"
26initialProcess :: String -> Process ()
27initialProcess "SERVER" = do
29 liftIO $ BSL.writeFile "pingServer.pid" (encode us)
31initialProcess "CLIENT" = do
33 them <- liftIO $ decode <$> BSL.readFile "pingServer.pid"
34 pingClient (read n) them
38 [role, host, port] <- getArgs
39 trans <- createTransport (defaultTCPAddr host port) defaultTCPParameters
41 Right transport -> do node <- newLocalNode transport initRemoteTable
42 runProcess node $ initialProcess role
43 Left other -> error $ show other
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list