diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-01-02 16:56:32 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-01-02 16:56:32 +0400 |
commit | b2c9a0c8183108643b738148d5c3fc210b754d98 (patch) | |
tree | c68c0ee93cf68db4829067600bc423747a65c34f /src/Network | |
parent | 787c68a0d847c60546693765180b1fa62734bdd1 (diff) |
Use K parameter in DHT session
Diffstat (limited to 'src/Network')
-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 |