diff options
author | joe <joe@jerkface.net> | 2017-01-04 00:28:03 -0500 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-01-04 00:28:03 -0500 |
commit | 19aa76afa7349cc3c91111b38ab3012f63380433 (patch) | |
tree | 5d855bf2870091a6f05fec238f12a7b625e94edf | |
parent | 9c872c37c55eb4d1f8d06920d344852e81cbcd77 (diff) |
Simpler 'shape' function.
-rw-r--r-- | src/Network/BitTorrent/DHT/Routing.hs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/Network/BitTorrent/DHT/Routing.hs b/src/Network/BitTorrent/DHT/Routing.hs index ba1f6799..8705a5a2 100644 --- a/src/Network/BitTorrent/DHT/Routing.hs +++ b/src/Network/BitTorrent/DHT/Routing.hs | |||
@@ -365,9 +365,7 @@ type NodeCount = Int | |||
365 | -- | Internally, routing table is similar to list of buckets or a | 365 | -- | Internally, routing table is similar to list of buckets or a |
366 | -- /matrix/ of nodes. This function returns the shape of the matrix. | 366 | -- /matrix/ of nodes. This function returns the shape of the matrix. |
367 | shape :: Table ip -> [BucketSize] | 367 | shape :: Table ip -> [BucketSize] |
368 | shape (Tip _ _ bucket) = [PSQ.size bucket] | 368 | shape = map PSQ.size . toBucketList |
369 | shape (Zero t bucket) = PSQ.size bucket : shape t | ||
370 | shape (One bucket t ) = PSQ.size bucket : shape t | ||
371 | 369 | ||
372 | -- | Get number of nodes in the table. | 370 | -- | Get number of nodes in the table. |
373 | size :: Table ip -> NodeCount | 371 | size :: Table ip -> NodeCount |