From 6a2506745dd06ad0849a1b0d440ad9751a69cf81 Mon Sep 17 00:00:00 2001 From: joe Date: Mon, 23 Jan 2017 18:20:21 -0500 Subject: New command "pid" to tell server's process id. --- examples/dhtd.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/dhtd.hs b/examples/dhtd.hs index 19b45acb..4afceb50 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs @@ -24,6 +24,7 @@ import System.IO.Error import Text.PrettyPrint.HughesPJClass import Text.Printf import Control.Monad.Reader.Class +import System.Posix.Process (getProcessID) import Network.BitTorrent.Address import Network.BitTorrent.DHT @@ -153,12 +154,16 @@ clientSession st signalQuit sock n h = do return $ do hPutClient h $ showReport r - ("peers ", s) -> cmd $ do + ("peers", s) -> cmd $ do let ih = fromString s ps <- allPeers ih return $ do hPutClient h $ showReport $ map (((,) "") . show . pPrint) ps + ("pid", _) -> cmd $ return $ do + pid <- getProcessID + hPutClient h (show pid) + _ -> cmd0 $ hPutClient h "error." main :: IO () -- cgit v1.2.3