summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/DHT.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/DHT.hs')
-rw-r--r--src/Network/BitTorrent/DHT.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Network/BitTorrent/DHT.hs b/src/Network/BitTorrent/DHT.hs
index 5cf7468e..5517e20f 100644
--- a/src/Network/BitTorrent/DHT.hs
+++ b/src/Network/BitTorrent/DHT.hs
@@ -27,7 +27,7 @@ module Network.BitTorrent.DHT
27 ) where 27 ) where
28 28
29import Control.Applicative 29import Control.Applicative
30import Control.Concurrent.Lifted 30import Control.Concurrent.Lifted hiding (yield)
31import Control.Exception.Lifted 31import Control.Exception.Lifted
32import Control.Monad 32import Control.Monad
33import Control.Monad.Logger 33import Control.Monad.Logger
@@ -42,6 +42,7 @@ import Data.Torrent.InfoHash
42import Network.BitTorrent.Core 42import Network.BitTorrent.Core
43import Network.BitTorrent.DHT.Message 43import Network.BitTorrent.DHT.Message
44import Network.BitTorrent.DHT.Session 44import Network.BitTorrent.DHT.Session
45import Network.KRPC
45 46
46 47
47{----------------------------------------------------------------------- 48{-----------------------------------------------------------------------
@@ -68,7 +69,7 @@ announceH = nodeHandler $ \ naddr (Announce {..}) -> do
68 $(logDebug) "announce received, trying to check token" 69 $(logDebug) "announce received, trying to check token"
69 checkToken naddr sessionToken 70 checkToken naddr sessionToken
70 case fromAddr naddr of 71 case fromAddr naddr of
71 Nothing -> undefined 72 Nothing -> throw $ KError ProtocolError "bad address" ""
72 Just paddr -> do 73 Just paddr -> do
73 insertPeer topic paddr 74 insertPeer topic paddr
74 return Announced 75 return Announced
@@ -111,7 +112,6 @@ bootstrap startNodes = do
111 $(logDebug) ("Get a list of closest nodes: " <> 112 $(logDebug) ("Get a list of closest nodes: " <>
112 T.pack (PP.render (pretty closest))) 113 T.pack (PP.render (pretty closest)))
113 forM_ (L.take 2 closest) $ \ info @ NodeInfo {..} -> do 114 forM_ (L.take 2 closest) $ \ info @ NodeInfo {..} -> do
114 _ <- insertNode info
115 let prettyAddr = T.pack (show (pretty nodeAddr)) 115 let prettyAddr = T.pack (show (pretty nodeAddr))
116 $(logInfoS) "bootstrap" $ "table detalization" <> prettyAddr 116 $(logInfoS) "bootstrap" $ "table detalization" <> prettyAddr
117 fork $ insertClosest nodeAddr 117 fork $ insertClosest nodeAddr