diff options
Diffstat (limited to 'src/Network/BitTorrent/DHT/Session.hs')
-rw-r--r-- | src/Network/BitTorrent/DHT/Session.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Network/BitTorrent/DHT/Session.hs b/src/Network/BitTorrent/DHT/Session.hs index 208f8ec8..0c806db2 100644 --- a/src/Network/BitTorrent/DHT/Session.hs +++ b/src/Network/BitTorrent/DHT/Session.hs | |||
@@ -90,7 +90,7 @@ import Network (PortNumber) | |||
90 | import System.Log.FastLogger | 90 | import System.Log.FastLogger |
91 | import System.Random (randomIO) | 91 | import System.Random (randomIO) |
92 | import Text.PrettyPrint as PP hiding ((<>), ($$)) | 92 | import Text.PrettyPrint as PP hiding ((<>), ($$)) |
93 | import Text.PrettyPrint.Class | 93 | import Text.PrettyPrint.HughesPJClass hiding ((<>),($$)) |
94 | 94 | ||
95 | import Data.Torrent as Torrent | 95 | import Data.Torrent as Torrent |
96 | import Network.KRPC hiding (Options, def) | 96 | import Network.KRPC hiding (Options, def) |
@@ -340,7 +340,7 @@ routing = runRouting probeNode refreshNodes getTimestamp | |||
340 | 340 | ||
341 | probeNode :: Address ip => NodeAddr ip -> DHT ip Bool | 341 | probeNode :: Address ip => NodeAddr ip -> DHT ip Bool |
342 | probeNode addr = do | 342 | probeNode addr = do |
343 | $(logDebugS) "routing.questionable_node" (T.pack (render (pretty addr))) | 343 | $(logDebugS) "routing.questionable_node" (T.pack (render (pPrint addr))) |
344 | result <- try $ Ping <@> addr | 344 | result <- try $ Ping <@> addr |
345 | let _ = result :: Either SomeException Ping | 345 | let _ = result :: Either SomeException Ping |
346 | return $ either (const False) (const True) result | 346 | return $ either (const False) (const True) result |
@@ -351,7 +351,7 @@ probeNode addr = do | |||
351 | -- FIXME do not use getClosest sinse we should /refresh/ them | 351 | -- FIXME do not use getClosest sinse we should /refresh/ them |
352 | refreshNodes :: Address ip => NodeId -> DHT ip [NodeInfo ip] | 352 | refreshNodes :: Address ip => NodeId -> DHT ip [NodeInfo ip] |
353 | refreshNodes nid = do | 353 | refreshNodes nid = do |
354 | $(logDebugS) "routing.refresh_bucket" (T.pack (render (pretty nid))) | 354 | $(logDebugS) "routing.refresh_bucket" (T.pack (render (pPrint nid))) |
355 | nodes <- getClosest nid | 355 | nodes <- getClosest nid |
356 | nss <- forM (nodeAddr <$> nodes) $ \ addr -> do | 356 | nss <- forM (nodeAddr <$> nodes) $ \ addr -> do |
357 | NodeFound ns <- FindNode nid <@> addr | 357 | NodeFound ns <- FindNode nid <@> addr |
@@ -361,7 +361,7 @@ refreshNodes nid = do | |||
361 | getTimestamp :: DHT ip Timestamp | 361 | getTimestamp :: DHT ip Timestamp |
362 | getTimestamp = do | 362 | getTimestamp = do |
363 | utcTime <- liftIO $ getCurrentTime | 363 | utcTime <- liftIO $ getCurrentTime |
364 | $(logDebugS) "routing.make_timestamp" (T.pack (render (pretty utcTime))) | 364 | $(logDebugS) "routing.make_timestamp" (T.pack (render (pPrint utcTime))) |
365 | return $ utcTimeToPOSIXSeconds utcTime | 365 | return $ utcTimeToPOSIXSeconds utcTime |
366 | 366 | ||
367 | {----------------------------------------------------------------------- | 367 | {----------------------------------------------------------------------- |
@@ -419,11 +419,11 @@ insertNode info = fork $ do | |||
419 | case result of | 419 | case result of |
420 | Nothing -> do | 420 | Nothing -> do |
421 | $(logDebugS) "insertNode" $ "Routing table is full: " | 421 | $(logDebugS) "insertNode" $ "Routing table is full: " |
422 | <> T.pack (show (pretty t)) | 422 | <> T.pack (show (pPrint t)) |
423 | return t | 423 | return t |
424 | Just t' -> do | 424 | Just t' -> do |
425 | let logMsg = "Routing table updated: " | 425 | let logMsg = "Routing table updated: " |
426 | <> pretty t <> " -> " <> pretty t' | 426 | <> pPrint t <> " -> " <> pPrint t' |
427 | $(logDebugS) "insertNode" (T.pack (render logMsg)) | 427 | $(logDebugS) "insertNode" (T.pack (render logMsg)) |
428 | return t' | 428 | return t' |
429 | 429 | ||