diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dhtd.hs | 7 |
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 | |||
24 | import Text.PrettyPrint.HughesPJClass | 24 | import Text.PrettyPrint.HughesPJClass |
25 | import Text.Printf | 25 | import Text.Printf |
26 | import Control.Monad.Reader.Class | 26 | import Control.Monad.Reader.Class |
27 | import System.Posix.Process (getProcessID) | ||
27 | 28 | ||
28 | import Network.BitTorrent.Address | 29 | import Network.BitTorrent.Address |
29 | import Network.BitTorrent.DHT | 30 | import 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 | ||
164 | main :: IO () | 169 | main :: IO () |