Bump scaling to 1000.

Note the error in integer arithmetic
This commit is contained in:
Nils O. Selåsdal
2013-10-12 01:28:20 +02:00
parent 8a76210661
commit 3d93ec6091
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -34,6 +34,13 @@
*
* uc_ratelimit_init(&r,20, 1, time(NULL));
*
* NOTE. The the internals uses integer arithmetic to replenish the tickets,
* this can lead to greater errors estimating the available tickets the smaller
* the number of tickets is in relation to the period. The arithmetic is scaled
* by 1000 currently, so if ticket = 1 and period = 60, we get 1000/60 = 16. This
* should be 16.6667, which is an error of about 3.6%, which means we really just
* rate limit to 1 per 62 seconds.
*
* for (;;) {
* int fd = accept(..);
* if (uc_ratelimit_allow(&r, time(NULL)) {