summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
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