diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-15 06:53:55 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-15 06:53:55 +0400 |
commit | ee1549c48c72f127622961df2e8e0472fcb77b13 (patch) | |
tree | e9d0d79478c6c96abf6cae6c39f8d9bed2e389f0 /src/Network | |
parent | 60e1502b8089f7a0acff7461a3a5c17741e7cec1 (diff) |
Add documentation to null and full function
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 |