summaryrefslogtreecommitdiff
path: root/examples/dhtd.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-01-23 23:24:24 -0500
committerjoe <joe@jerkface.net>2017-01-23 23:24:24 -0500
commit1c01fae3a00942fd0d42f8b8e832e2665a679213 (patch)
treea0c9fd48f5b0a4aa8b9b1da1f9c2f2f381863a3a /examples/dhtd.hs
parent2ced7fa5b110d19f0e6cc21968822f4ccf880c13 (diff)
Query.insertNode no longer forks.
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r--examples/dhtd.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index 0345e1ee..569e1d3d 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -23,6 +23,7 @@ import System.IO
23import System.IO.Error 23import System.IO.Error
24import Text.PrettyPrint.HughesPJClass 24import Text.PrettyPrint.HughesPJClass
25import Text.Printf 25import Text.Printf
26import Text.Read
26import Control.Monad.Reader.Class 27import Control.Monad.Reader.Class
27import System.Posix.Process (getProcessID) 28import System.Posix.Process (getProcessID)
28 29
@@ -163,11 +164,12 @@ clientSession st signalQuit sock n h = do
163 return $ do 164 return $ do
164 hPutClient h $ showReport r 165 hPutClient h $ showReport r
165 166
166 ("peers", s) -> cmd $ do 167 ("peers", s) -> cmd $ case readEither s of
167 let ih = fromString s 168 Right ih -> do
168 ps <- allPeers ih 169 ps <- allPeers ih
169 return $ do 170 seq ih $ return $ do
170 hPutClient h $ showReport $ map (((,) "") . show . pPrint) ps 171 hPutClient h $ showReport $ map (((,) "") . show . pPrint) ps
172 Left er -> return $ hPutClient h er
171 173
172 ("pid", _) -> cmd $ return $ do 174 ("pid", _) -> cmd $ return $ do
173 pid <- getProcessID 175 pid <- getProcessID