1import System.Environment
3import Control.Applicative
4import Control.Distributed.Process
5import Control.Distributed.Process.Node
6import Network.Transport.TCP (createTransport, defaultTCPAddr, defaultTCPParameters)
7import Data.Binary (encode, decode)
8import qualified Data.ByteString.Lazy as BSL
10pingServer :: Process ()
11pingServer = forever $ do
15pingClient :: Int -> ProcessId -> Process ()
18 replicateM_ n $ send them us >> (expect :: Process ())
19 liftIO . putStrLn $ "Did " ++ show n ++ " pings"
21initialProcess :: String -> Process ()
22initialProcess "SERVER" = do
24 liftIO $ BSL.writeFile "pingServer.pid" (encode us)
26initialProcess "CLIENT" = do
28 them <- liftIO $ decode <$> BSL.readFile "pingServer.pid"
29 pingClient (read n) them
33 [role, host, port] <- getArgs
34 trans <- createTransport
35 (defaultTCPAddr host port) defaultTCPParameters
37 Right transport -> do node <- newLocalNode transport initRemoteTable
38 runProcess node $ initialProcess role
39 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