summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-02-15 06:53:55 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-02-15 06:53:55 +0400
commitee1549c48c72f127622961df2e8e0472fcb77b13 (patch)
treee9d0d79478c6c96abf6cae6c39f8d9bed2e389f0 /src/Network
parent60e1502b8089f7a0acff7461a3a5c17741e7cec1 (diff)
Add documentation to null and full function
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/BitTorrent/DHT/Routing.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/DHT/Routing.hs b/src/Network/BitTorrent/DHT/Routing.hs
index 57085cf4..8e09d95e 100644
--- a/src/Network/BitTorrent/DHT/Routing.hs
+++ b/src/Network/BitTorrent/DHT/Routing.hs
@@ -337,10 +337,14 @@ nullTable nid n = Tip nid (bucketCount (pred n)) PSQ.empty
337 where 337 where
338 bucketCount x = max 0 (min 159 x) 338 bucketCount x = max 0 (min 159 x)
339 339
340-- | Test if table is empty. In this case DHT should start
341-- bootstrapping process until table becomes 'full'.
340null :: Table ip -> Bool 342null :: Table ip -> Bool
341null (Tip _ _ b) = PSQ.null b 343null (Tip _ _ b) = PSQ.null b
342null _ = False 344null _ = False
343 345
346-- | Test if table have maximum number of nodes. No more nodes can be
347-- 'insert'ed, except old ones becomes bad.
344full :: Table ip -> Bool 348full :: Table ip -> Bool
345full (Tip _ n _) = n == 0 349full (Tip _ n _) = n == 0
346full (Zero t b) = PSQ.size b == defaultBucketSize && full t 350full (Zero t b) = PSQ.size b == defaultBucketSize && full t