summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-01-09 04:39:50 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-01-09 04:39:50 +0400
commit299a299412b0c3c15966996f3466db3960e324e7 (patch)
tree1e894430c57a055252360d7ba512b995e9832d74 /src/Network
parent408c48e657f3f40b80ef5ba1cbdb3871de20857a (diff)
Use K parameter in routing table lookups
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/BitTorrent/DHT/Routing.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Network/BitTorrent/DHT/Routing.hs b/src/Network/BitTorrent/DHT/Routing.hs
index 22076a39..293d58ab 100644
--- a/src/Network/BitTorrent/DHT/Routing.hs
+++ b/src/Network/BitTorrent/DHT/Routing.hs
@@ -386,7 +386,8 @@ defaultK = 8
386-- | Get a list of /K/ closest nodes using XOR metric. Used in 386-- | Get a list of /K/ closest nodes using XOR metric. Used in
387-- 'find_node' queries. 387-- 'find_node' queries.
388kclosest :: Eq ip => K -> NodeId -> Table ip -> [NodeInfo ip] 388kclosest :: Eq ip => K -> NodeId -> Table ip -> [NodeInfo ip]
389kclosest k nid = L.map key . PSQ.toList . fromMaybe PSQ.empty 389kclosest k nid = L.take k . rank nid
390 . L.map key . PSQ.toList . fromMaybe PSQ.empty
390 . lookupBucket nid 391 . lookupBucket nid
391 392
392coerceId :: (Serialize a, Serialize b) => a -> b 393coerceId :: (Serialize a, Serialize b) => a -> b