diff options
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/BitTorrent/DHT/Routing.hs | 4 |
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'. | ||
340 | null :: Table ip -> Bool | 342 | null :: Table ip -> Bool |
341 | null (Tip _ _ b) = PSQ.null b | 343 | null (Tip _ _ b) = PSQ.null b |
342 | null _ = False | 344 | null _ = 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. | ||
344 | full :: Table ip -> Bool | 348 | full :: Table ip -> Bool |
345 | full (Tip _ n _) = n == 0 | 349 | full (Tip _ n _) = n == 0 |
346 | full (Zero t b) = PSQ.size b == defaultBucketSize && full t | 350 | full (Zero t b) = PSQ.size b == defaultBucketSize && full t |