summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/dhtd.hs12
-rw-r--r--src/Network/BitTorrent/DHT/Query.hs5
2 files changed, 9 insertions, 8 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
diff --git a/src/Network/BitTorrent/DHT/Query.hs b/src/Network/BitTorrent/DHT/Query.hs
index 47d17622..533068c6 100644
--- a/src/Network/BitTorrent/DHT/Query.hs
+++ b/src/Network/BitTorrent/DHT/Query.hs
@@ -231,9 +231,8 @@ refreshNodes nid = do
231 231
232-- | This operation do not block but acquire exclusive access to 232-- | This operation do not block but acquire exclusive access to
233-- routing table. 233-- routing table.
234insertNode :: forall ip. Address ip => NodeInfo ip -> Maybe ReflectedIP -> DHT ip ThreadId 234insertNode :: forall ip. Address ip => NodeInfo ip -> Maybe ReflectedIP -> DHT ip ()
235insertNode info witnessed_ip0 = fork $ do 235insertNode info witnessed_ip0 = do
236 -- myThreadId >>= liftIO . flip labelThread "DHT.insertNode"
237 var <- asks routingInfo 236 var <- asks routingInfo
238 tm <- getTimestamp 237 tm <- getTimestamp
239 let showTable = do 238 let showTable = do