diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-01-02 22:27:28 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-01-02 22:27:28 +0400 |
commit | 469b2c84af865863a852bda5137640a2463c9a8b (patch) | |
tree | 4ca03913a1e1eae6271ea5d45a3fb3efda2b54dc /src/Network/BitTorrent/DHT/Routing.hs | |
parent | ab565965354a238bc57b95bd56135ecce40751c6 (diff) |
Add bucket count option
Diffstat (limited to 'src/Network/BitTorrent/DHT/Routing.hs')
-rw-r--r-- | src/Network/BitTorrent/DHT/Routing.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Network/BitTorrent/DHT/Routing.hs b/src/Network/BitTorrent/DHT/Routing.hs index 4897a22e..f6926cb1 100644 --- a/src/Network/BitTorrent/DHT/Routing.hs +++ b/src/Network/BitTorrent/DHT/Routing.hs | |||
@@ -325,8 +325,10 @@ instance Pretty (Table ip) where | |||
325 | ss = shape t | 325 | ss = shape t |
326 | 326 | ||
327 | -- | Empty table with specified /spine/ node id. | 327 | -- | Empty table with specified /spine/ node id. |
328 | nullTable :: Eq ip => NodeId -> Table ip | 328 | nullTable :: Eq ip => NodeId -> BucketCount -> Table ip |
329 | nullTable nid = Tip nid defaultBucketCount PSQ.empty | 329 | nullTable nid n = Tip nid (bucketCount (pred n)) PSQ.empty |
330 | where | ||
331 | bucketCount x = max 0 (min 160 x) | ||
330 | 332 | ||
331 | -- | Get the /spine/ node id. | 333 | -- | Get the /spine/ node id. |
332 | thisId :: Table ip -> NodeId | 334 | thisId :: Table ip -> NodeId |