summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/dhtd.hs7
1 files changed, 6 insertions, 1 deletions
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
24import Text.PrettyPrint.HughesPJClass 24import Text.PrettyPrint.HughesPJClass
25import Text.Printf 25import Text.Printf
26import Control.Monad.Reader.Class 26import Control.Monad.Reader.Class
27import System.Posix.Process (getProcessID)
27 28
28import Network.BitTorrent.Address 29import Network.BitTorrent.Address
29import Network.BitTorrent.DHT 30import Network.BitTorrent.DHT
@@ -153,12 +154,16 @@ clientSession st signalQuit sock n h = do
153 return $ do 154 return $ do
154 hPutClient h $ showReport r 155 hPutClient h $ showReport r
155 156
156 ("peers ", s) -> cmd $ do 157 ("peers", s) -> cmd $ do
157 let ih = fromString s 158 let ih = fromString s
158 ps <- allPeers ih 159 ps <- allPeers ih
159 return $ do 160 return $ do
160 hPutClient h $ showReport $ map (((,) "") . show . pPrint) ps 161 hPutClient h $ showReport $ map (((,) "") . show . pPrint) ps
161 162
163 ("pid", _) -> cmd $ return $ do
164 pid <- getProcessID
165 hPutClient h (show pid)
166
162 _ -> cmd0 $ hPutClient h "error." 167 _ -> cmd0 $ hPutClient h "error."
163 168
164main :: IO () 169main :: IO ()