mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Amend token_bucket_rw_dec to indicate which buckets became empty.
This commit is contained in:
parent
1356d51af6
commit
b36c450b57
@ -238,13 +238,18 @@ token_bucket_rw_dec_write(token_bucket_rw_t *bucket,
|
||||
|
||||
/**
|
||||
* As token_bucket_rw_dec_read and token_bucket_rw_dec_write, in a single
|
||||
* operation.
|
||||
* operation. Return a bitmask of TB_READ and TB_WRITE to indicate
|
||||
* which buckets became empty.
|
||||
*/
|
||||
void
|
||||
int
|
||||
token_bucket_rw_dec(token_bucket_rw_t *bucket,
|
||||
ssize_t n_read, ssize_t n_written)
|
||||
{
|
||||
token_bucket_rw_dec_read(bucket, n_read);
|
||||
token_bucket_rw_dec_write(bucket, n_written);
|
||||
int flags = 0;
|
||||
if (token_bucket_rw_dec_read(bucket, n_read))
|
||||
flags |= TB_READ;
|
||||
if (token_bucket_rw_dec_write(bucket, n_written))
|
||||
flags |= TB_WRITE;
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
@ -85,8 +85,8 @@ int token_bucket_rw_dec_read(token_bucket_rw_t *bucket,
|
||||
int token_bucket_rw_dec_write(token_bucket_rw_t *bucket,
|
||||
ssize_t n);
|
||||
|
||||
void token_bucket_rw_dec(token_bucket_rw_t *bucket,
|
||||
ssize_t n_read, ssize_t n_written);
|
||||
int token_bucket_rw_dec(token_bucket_rw_t *bucket,
|
||||
ssize_t n_read, ssize_t n_written);
|
||||
|
||||
static inline size_t token_bucket_rw_get_read(const token_bucket_rw_t *bucket);
|
||||
static inline size_t
|
||||
|
Loading…
Reference in New Issue
Block a user