diff options
Diffstat (limited to 'src/Network/BitTorrent/DHT.hs')
-rw-r--r-- | src/Network/BitTorrent/DHT.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Network/BitTorrent/DHT.hs b/src/Network/BitTorrent/DHT.hs index aaa1cf33..ab948a2d 100644 --- a/src/Network/BitTorrent/DHT.hs +++ b/src/Network/BitTorrent/DHT.hs | |||
@@ -17,6 +17,7 @@ | |||
17 | {-# LANGUAGE FlexibleInstances #-} | 17 | {-# LANGUAGE FlexibleInstances #-} |
18 | {-# LANGUAGE TemplateHaskell #-} | 18 | {-# LANGUAGE TemplateHaskell #-} |
19 | {-# LANGUAGE TypeOperators #-} | 19 | {-# LANGUAGE TypeOperators #-} |
20 | {-# LANGUAGE ScopedTypeVariables #-} | ||
20 | module Network.BitTorrent.DHT | 21 | module Network.BitTorrent.DHT |
21 | ( -- * Distributed Hash Table | 22 | ( -- * Distributed Hash Table |
22 | DHT | 23 | DHT |
@@ -70,6 +71,7 @@ import Network.BitTorrent.DHT.Session | |||
70 | import Network.BitTorrent.DHT.Routing as T hiding (null) | 71 | import Network.BitTorrent.DHT.Routing as T hiding (null) |
71 | import qualified Data.Text as Text | 72 | import qualified Data.Text as Text |
72 | import Data.Monoid | 73 | import Data.Monoid |
74 | import Network.KRPC.Message (KMessageOf) | ||
73 | 75 | ||
74 | 76 | ||
75 | {----------------------------------------------------------------------- | 77 | {----------------------------------------------------------------------- |
@@ -166,7 +168,7 @@ resolveHostName NodeAddr {..} = do | |||
166 | -- | 168 | -- |
167 | -- This operation do block, use | 169 | -- This operation do block, use |
168 | -- 'Control.Concurrent.Async.Lifted.async' if needed. | 170 | -- 'Control.Concurrent.Async.Lifted.async' if needed. |
169 | bootstrap :: Address ip => Maybe BS.ByteString -> [NodeAddr ip] -> DHT ip () | 171 | bootstrap :: forall ip. Address ip => Maybe BS.ByteString -> [NodeAddr ip] -> DHT ip () |
170 | bootstrap mbs startNodes = do | 172 | bootstrap mbs startNodes = do |
171 | restored <- | 173 | restored <- |
172 | case decode <$> mbs of | 174 | case decode <$> mbs of |
@@ -178,7 +180,8 @@ bootstrap mbs startNodes = do | |||
178 | $(logInfoS) "bootstrap" "Start node bootstrapping" | 180 | $(logInfoS) "bootstrap" "Start node bootstrapping" |
179 | let searchAll aliveNodes = do | 181 | let searchAll aliveNodes = do |
180 | nid <- myNodeIdAccordingTo (error "FIXME") | 182 | nid <- myNodeIdAccordingTo (error "FIXME") |
181 | C.sourceList [aliveNodes] $= search nid (findNodeQ nid) $$ C.consume | 183 | nss <- C.sourceList [aliveNodes] $= search nid (findNodeQ nid) $$ C.consume |
184 | return ( nss :: [[NodeInfo KMessageOf ip ()]] ) | ||
182 | input_nodes <- (restored ++) . T.toList <$> getTable | 185 | input_nodes <- (restored ++) . T.toList <$> getTable |
183 | -- Step 1: Use iterative searches to flesh out the table.. | 186 | -- Step 1: Use iterative searches to flesh out the table.. |
184 | do let knowns = map (map $ nodeAddr . fst) input_nodes | 187 | do let knowns = map (map $ nodeAddr . fst) input_nodes |