diff options
-rw-r--r-- | src/Network/BitTorrent/DHT/Session.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Network/BitTorrent/DHT/Session.hs b/src/Network/BitTorrent/DHT/Session.hs index debe9694..ac285bdc 100644 --- a/src/Network/BitTorrent/DHT/Session.hs +++ b/src/Network/BitTorrent/DHT/Session.hs | |||
@@ -254,12 +254,15 @@ getNodeId :: DHT ip NodeId | |||
254 | getNodeId = thisId <$> getTable | 254 | getNodeId = thisId <$> getTable |
255 | 255 | ||
256 | getClosest :: Eq ip => NodeId -> DHT ip [NodeInfo ip] | 256 | getClosest :: Eq ip => NodeId -> DHT ip [NodeInfo ip] |
257 | getClosest nid = kclosest 8 nid <$> getTable | 257 | getClosest nid = do |
258 | k <- asks (optK . options) | ||
259 | kclosest k nid <$> getTable | ||
258 | 260 | ||
259 | getClosestHash :: Eq ip => InfoHash -> DHT ip [NodeInfo ip] | 261 | getClosestHash :: Eq ip => InfoHash -> DHT ip [NodeInfo ip] |
260 | getClosestHash ih = kclosestHash 8 ih <$> getTable | 262 | getClosestHash ih = do |
263 | k <- asks (optK . options) | ||
264 | kclosestHash k ih <$> getTable | ||
261 | 265 | ||
262 | -- FIXME some nodes can be ommited | ||
263 | insertNode :: Address ip => NodeInfo ip -> DHT ip ThreadId | 266 | insertNode :: Address ip => NodeInfo ip -> DHT ip ThreadId |
264 | insertNode info = fork $ do | 267 | insertNode info = fork $ do |
265 | var <- asks routingTable | 268 | var <- asks routingTable |