summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Network/BitTorrent/DHT/Session.hs9
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
254getNodeId = thisId <$> getTable 254getNodeId = thisId <$> getTable
255 255
256getClosest :: Eq ip => NodeId -> DHT ip [NodeInfo ip] 256getClosest :: Eq ip => NodeId -> DHT ip [NodeInfo ip]
257getClosest nid = kclosest 8 nid <$> getTable 257getClosest nid = do
258 k <- asks (optK . options)
259 kclosest k nid <$> getTable
258 260
259getClosestHash :: Eq ip => InfoHash -> DHT ip [NodeInfo ip] 261getClosestHash :: Eq ip => InfoHash -> DHT ip [NodeInfo ip]
260getClosestHash ih = kclosestHash 8 ih <$> getTable 262getClosestHash ih = do
263 k <- asks (optK . options)
264 kclosestHash k ih <$> getTable
261 265
262-- FIXME some nodes can be ommited
263insertNode :: Address ip => NodeInfo ip -> DHT ip ThreadId 266insertNode :: Address ip => NodeInfo ip -> DHT ip ThreadId
264insertNode info = fork $ do 267insertNode info = fork $ do
265 var <- asks routingTable 268 var <- asks routingTable