diff options
author | joe <joe@jerkface.net> | 2017-01-22 21:26:22 -0500 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-01-22 21:26:22 -0500 |
commit | be0436e4d5c301fa643799cc41b204459d696f17 (patch) | |
tree | 17bae90fceaecc1928179580ef7bc51c31048d6e /examples | |
parent | 655efe0e7e1b25e2b4d333cf7551998ed69a4dfa (diff) |
Added "peers" command to cli.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dhtd.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index 96c31dfe..bc5e9eda 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -15,6 +15,7 @@ import Data.Char | |||
15 | import Data.Default | 15 | import Data.Default |
16 | import Data.List as L | 16 | import Data.List as L |
17 | import Data.Maybe | 17 | import Data.Maybe |
18 | import Data.String | ||
18 | import qualified Data.ByteString as B (ByteString,writeFile,readFile) | 19 | import qualified Data.ByteString as B (ByteString,writeFile,readFile) |
19 | ; import Data.ByteString (ByteString) | 20 | ; import Data.ByteString (ByteString) |
20 | import System.IO | 21 | import System.IO |
@@ -140,6 +141,12 @@ clientSession st signalQuit sock n h = do | |||
140 | return $ do | 141 | return $ do |
141 | hPutClient h $ showReport r | 142 | hPutClient h $ showReport r |
142 | 143 | ||
144 | s | "peers " `isPrefixOf` s -> cmd $ do | ||
145 | let ih = fromString (drop 6 s) | ||
146 | ps <- allPeers ih | ||
147 | return $ do | ||
148 | hPutClient h $ showReport $ map (((,) "") . show . pPrint) ps | ||
149 | |||
143 | _ -> cmd0 $ hPutClient h "error." | 150 | _ -> cmd0 $ hPutClient h "error." |
144 | 151 | ||
145 | main :: IO () | 152 | main :: IO () |