summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-01-22 21:26:22 -0500
committerjoe <joe@jerkface.net>2017-01-22 21:26:22 -0500
commitbe0436e4d5c301fa643799cc41b204459d696f17 (patch)
tree17bae90fceaecc1928179580ef7bc51c31048d6e /examples
parent655efe0e7e1b25e2b4d333cf7551998ed69a4dfa (diff)
Added "peers" command to cli.
Diffstat (limited to 'examples')
-rw-r--r--examples/dhtd.hs7
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
15import Data.Default 15import Data.Default
16import Data.List as L 16import Data.List as L
17import Data.Maybe 17import Data.Maybe
18import Data.String
18import qualified Data.ByteString as B (ByteString,writeFile,readFile) 19import qualified Data.ByteString as B (ByteString,writeFile,readFile)
19 ; import Data.ByteString (ByteString) 20 ; import Data.ByteString (ByteString)
20import System.IO 21import 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
145main :: IO () 152main :: IO ()