summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-01-04 00:28:03 -0500
committerjoe <joe@jerkface.net>2017-01-04 00:28:03 -0500
commit19aa76afa7349cc3c91111b38ab3012f63380433 (patch)
tree5d855bf2870091a6f05fec238f12a7b625e94edf
parent9c872c37c55eb4d1f8d06920d344852e81cbcd77 (diff)
Simpler 'shape' function.
-rw-r--r--src/Network/BitTorrent/DHT/Routing.hs4
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.
367shape :: Table ip -> [BucketSize] 367shape :: Table ip -> [BucketSize]
368shape (Tip _ _ bucket) = [PSQ.size bucket] 368shape = map PSQ.size . toBucketList
369shape (Zero t bucket) = PSQ.size bucket : shape t
370shape (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.
373size :: Table ip -> NodeCount 371size :: Table ip -> NodeCount