diff options
-rw-r--r-- | examples/dhtd.hs | 4 | ||||
-rw-r--r-- | src/Network/Kademlia/Bootstrap.hs | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index 19fee119..89604919 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -1310,7 +1310,7 @@ newXmmpSink session@(Tox.NCrypto { ncOutgoingQueue = outGoingQVar, ncPacketQueue | |||
1310 | OGSuccess -> return OGSuccess | 1310 | OGSuccess -> return OGSuccess |
1311 | OGEncodeFail -> return OGEncodeFail | 1311 | OGEncodeFail -> return OGEncodeFail |
1312 | when (r == OGEncodeFail) $ | 1312 | when (r == OGEncodeFail) $ |
1313 | hPutStrLn stderr ("FAILURE to Encode Outgoing: " ++ show msg) | 1313 | dput XMisc ("FAILURE to Encode Outgoing: " ++ show msg) |
1314 | sendit session Flush = return () | 1314 | sendit session Flush = return () |
1315 | liftIO $ sendit session flush_cyptomessage | 1315 | liftIO $ sendit session flush_cyptomessage |
1316 | 1316 | ||
@@ -1381,7 +1381,7 @@ main = runResourceT $ liftBaseWith $ \resT -> do | |||
1381 | swarms <- Mainline.newSwarmsDatabase | 1381 | swarms <- Mainline.newSwarmsDatabase |
1382 | -- Restore peer database before forking the listener thread. | 1382 | -- Restore peer database before forking the listener thread. |
1383 | peerdb <- left show <$> tryIOError (L.readFile "bt-peers.dat") | 1383 | peerdb <- left show <$> tryIOError (L.readFile "bt-peers.dat") |
1384 | either (hPutStrLn stderr . ("bt-peers.dat: "++)) | 1384 | either (dput XMisc . ("bt-peers.dat: "++)) |
1385 | (atomically . writeTVar (Mainline.contactInfo swarms)) | 1385 | (atomically . writeTVar (Mainline.contactInfo swarms)) |
1386 | (peerdb >>= S.decodeLazy) | 1386 | (peerdb >>= S.decodeLazy) |
1387 | 1387 | ||
diff --git a/src/Network/Kademlia/Bootstrap.hs b/src/Network/Kademlia/Bootstrap.hs index 93cf08f3..bc8188a7 100644 --- a/src/Network/Kademlia/Bootstrap.hs +++ b/src/Network/Kademlia/Bootstrap.hs | |||
@@ -39,6 +39,7 @@ import System.Timeout | |||
39 | import Text.PrettyPrint as PP hiding (($$), (<>)) | 39 | import Text.PrettyPrint as PP hiding (($$), (<>)) |
40 | import Text.PrettyPrint.HughesPJClass hiding (($$), (<>)) | 40 | import Text.PrettyPrint.HughesPJClass hiding (($$), (<>)) |
41 | import System.IO | 41 | import System.IO |
42 | import DPut | ||
42 | 43 | ||
43 | import qualified Data.Wrapper.PSQInt as Int | 44 | import qualified Data.Wrapper.PSQInt as Int |
44 | ;import Data.Wrapper.PSQInt (pattern (:->)) | 45 | ;import Data.Wrapper.PSQInt (pattern (:->)) |
@@ -258,7 +259,7 @@ refreshBucket r@BucketRefresher{ refreshSearch = sch | |||
258 | _ <- timeout (15*60*1000000) $ do | 259 | _ <- timeout (15*60*1000000) $ do |
259 | atomically $ searchIsFinished s >>= check | 260 | atomically $ searchIsFinished s >>= check |
260 | atomically $ searchCancel s | 261 | atomically $ searchCancel s |
261 | hPutStrLn stderr $ "Finish refresh " ++ show (n,sample) | 262 | dput XDHT $ "Finish refresh " ++ show (n,sample) |
262 | now <- getPOSIXTime | 263 | now <- getPOSIXTime |
263 | join $ atomically $ onFinishedRefresh r n now | 264 | join $ atomically $ onFinishedRefresh r n now |
264 | rcount <- atomically $ do | 265 | rcount <- atomically $ do |
@@ -316,7 +317,7 @@ bootstrap r@BucketRefresher { refreshSearch = sch | |||
316 | forM_ ns0 $ \n -> do | 317 | forM_ ns0 $ \n -> do |
317 | forkTask g (show $ kademliaLocation (searchSpace sch) n) | 318 | forkTask g (show $ kademliaLocation (searchSpace sch) n) |
318 | (void $ ping n) | 319 | (void $ ping n) |
319 | hPutStrLn stderr "Finished bootstrap pings." | 320 | dput XDHT "Finished bootstrap pings." |
320 | -- Now search our own Id by entering bootstrap mode from non-bootstrap mode. | 321 | -- Now search our own Id by entering bootstrap mode from non-bootstrap mode. |
321 | join $ atomically $ do | 322 | join $ atomically $ do |
322 | writeTVar bootstrapMode False | 323 | writeTVar bootstrapMode False |