diff options
author | David Goulet <dgoulet@torproject.org> | 2020-01-22 11:06:11 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-02-11 09:34:55 -0500 |
commit | ee55823a11b711fc4af6c3c906c341c057a414f3 (patch) | |
tree | 1f79bf8186d6efc7a6237e46fa12ed0feb6b66a9 /src/core | |
parent | 00fe214729b935adc522883fa84b399429fefa74 (diff) | |
download | tor-ee55823a11b711fc4af6c3c906c341c057a414f3.tar.gz tor-ee55823a11b711fc4af6c3c906c341c057a414f3.zip |
mainloop: Rename global_write_bucket_low()
That function is only used to test the global bucket write limit for a
directory connection.
It should _not_ be used for anything else since that function looks to see if
we are a directory authority.
Rename it to something more meaningful. No change in behavior at this commit,
only renaming.
Part of #33029
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/mainloop/connection.c | 7 | ||||
-rw-r--r-- | src/core/mainloop/connection.h | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c index 6094f33e4d..2c075ba6be 100644 --- a/src/core/mainloop/connection.c +++ b/src/core/mainloop/connection.c @@ -3186,9 +3186,9 @@ connection_bucket_write_limit(connection_t *conn, time_t now) global_bucket_val, conn_bucket); } -/** Return 1 if the global write buckets are low enough that we +/** Return true iff the global write buckets are low enough that we * shouldn't send <b>attempt</b> bytes of low-priority directory stuff - * out to <b>conn</b>. Else return 0. + * out to <b>conn</b>. * Priority was 1 for v1 requests (directories and running-routers), * and 2 for v2 requests and later (statuses and descriptors). @@ -3206,7 +3206,8 @@ connection_bucket_write_limit(connection_t *conn, time_t now) * that's harder to quantify and harder to keep track of. */ int -global_write_bucket_low(connection_t *conn, size_t attempt, int priority) +connection_dir_is_global_write_low(connection_t *conn, size_t attempt, + int priority) { size_t smaller_bucket = MIN(token_bucket_rw_get_write(&global_bucket), diff --git a/src/core/mainloop/connection.h b/src/core/mainloop/connection.h index c93f1ef8e8..4f15c1dd6f 100644 --- a/src/core/mainloop/connection.h +++ b/src/core/mainloop/connection.h @@ -195,8 +195,9 @@ int retry_all_listeners(smartlist_t *new_conns, void connection_mark_all_noncontrol_listeners(void); void connection_mark_all_noncontrol_connections(void); -ssize_t connection_bucket_write_limit(connection_t *conn, time_t now); -int global_write_bucket_low(connection_t *conn, size_t attempt, int priority); +ssize_t connection_bucket_write_limit(struct connection_t *conn, time_t now); +int connection_dir_is_global_write_low(struct connection_t *conn, + size_t attempt, int priority); void connection_bucket_init(void); void connection_bucket_adjust(const or_options_t *options); void connection_bucket_refill_all(time_t now, |