X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Ftbf.c;h=9f8404e18dd96fc41b49d8ad9a2ca39e1b7fac80;hb=0f88062c8973258611a8cba9a0e9668d1c688030;hp=7e4d474ef82793e4a9fdb08c78f3e6c792b0ad3c;hpb=16f04029db50b765d952cf4cf053d34262a40db1;p=libucw.git diff --git a/ucw/tbf.c b/ucw/tbf.c index 7e4d474e..9f8404e1 100644 --- a/ucw/tbf.c +++ b/ucw/tbf.c @@ -29,13 +29,16 @@ tbf_limit(struct token_bucket_filter *f, timestamp_t now) b = MIN(b, f->burst); if (b >= 1) { + uns dropped = f->drop_count; f->bucket = b - 1; - return 1; + f->drop_count = 0; + return dropped; } else { f->bucket = b; - return 0; + f->drop_count++; + return -f->drop_count; } }