mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
Add a helper function to decrement read and write at the same time
This commit is contained in:
parent
c376200f6a
commit
8a85239746
@ -178,3 +178,14 @@ token_bucket_dec_write(token_bucket_t *bucket,
|
||||
return decrement_single_bucket(&bucket->write_bucket, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* As token_bucket_dec_read and token_bucket_dec_write, in a single operation.
|
||||
*/
|
||||
void
|
||||
token_bucket_dec(token_bucket_t *bucket,
|
||||
ssize_t n_read, ssize_t n_written)
|
||||
{
|
||||
token_bucket_dec_read(bucket, n_read);
|
||||
token_bucket_dec_read(bucket, n_written);
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,9 @@ int token_bucket_dec_read(token_bucket_t *bucket,
|
||||
int token_bucket_dec_write(token_bucket_t *bucket,
|
||||
ssize_t n);
|
||||
|
||||
void token_bucket_dec(token_bucket_t *bucket,
|
||||
ssize_t n_read, ssize_t n_written);
|
||||
|
||||
static inline size_t token_bucket_get_read(const token_bucket_t *bucket);
|
||||
static inline size_t
|
||||
token_bucket_get_read(const token_bucket_t *bucket)
|
||||
|
Loading…
Reference in New Issue
Block a user