diff options
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/BitTorrent/DHT.hs | 6 |
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 | ||
29 | import Control.Applicative | 29 | import Control.Applicative |
30 | import Control.Concurrent.Lifted | 30 | import Control.Concurrent.Lifted hiding (yield) |
31 | import Control.Exception.Lifted | 31 | import Control.Exception.Lifted |
32 | import Control.Monad | 32 | import Control.Monad |
33 | import Control.Monad.Logger | 33 | import Control.Monad.Logger |
@@ -42,6 +42,7 @@ import Data.Torrent.InfoHash | |||
42 | import Network.BitTorrent.Core | 42 | import Network.BitTorrent.Core |
43 | import Network.BitTorrent.DHT.Message | 43 | import Network.BitTorrent.DHT.Message |
44 | import Network.BitTorrent.DHT.Session | 44 | import Network.BitTorrent.DHT.Session |
45 | import 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 |