diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-01-09 04:39:50 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-01-09 04:39:50 +0400 |
commit | 299a299412b0c3c15966996f3466db3960e324e7 (patch) | |
tree | 1e894430c57a055252360d7ba512b995e9832d74 /src | |
parent | 408c48e657f3f40b80ef5ba1cbdb3871de20857a (diff) |
Use K parameter in routing table lookups
Diffstat (limited to 'src')
-rw-r--r-- | src/Network/BitTorrent/DHT/Routing.hs | 3 |
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. |
388 | kclosest :: Eq ip => K -> NodeId -> Table ip -> [NodeInfo ip] | 388 | kclosest :: Eq ip => K -> NodeId -> Table ip -> [NodeInfo ip] |
389 | kclosest k nid = L.map key . PSQ.toList . fromMaybe PSQ.empty | 389 | kclosest k nid = L.take k . rank nid |
390 | . L.map key . PSQ.toList . fromMaybe PSQ.empty | ||
390 | . lookupBucket nid | 391 | . lookupBucket nid |
391 | 392 | ||
392 | coerceId :: (Serialize a, Serialize b) => a -> b | 393 | coerceId :: (Serialize a, Serialize b) => a -> b |