summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-01-02 16:56:32 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-01-02 16:56:32 +0400
commitb2c9a0c8183108643b738148d5c3fc210b754d98 (patch)
treec68c0ee93cf68db4829067600bc423747a65c34f /src
parent787c68a0d847c60546693765180b1fa62734bdd1 (diff)
Use K parameter in DHT session
Diffstat (limited to 'src')
-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