aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dircache
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-02-20 08:50:18 -0500
committerNick Mathewson <nickm@torproject.org>2020-02-20 08:50:18 -0500
commit09fb7987c5bfa248efba2961afe5eb5c8f5a6e9c (patch)
tree477fe09eab200eb65d35004d14e7c882c915f923 /src/feature/dircache
parentd559ca3d5aa693e4606e34888048eeda0f5c2e97 (diff)
parentf733b8acd67f487a56e56bfb454ff99bc8d1cab0 (diff)
downloadtor-09fb7987c5bfa248efba2961afe5eb5c8f5a6e9c.tar.gz
tor-09fb7987c5bfa248efba2961afe5eb5c8f5a6e9c.zip
Merge branch 'maint-0.4.3'
Diffstat (limited to 'src/feature/dircache')
-rw-r--r--src/feature/dircache/dircache.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/feature/dircache/dircache.c b/src/feature/dircache/dircache.c
index 9e1794272e..4f7f209207 100644
--- a/src/feature/dircache/dircache.c
+++ b/src/feature/dircache/dircache.c
@@ -957,7 +957,7 @@ handle_get_current_consensus(dir_connection_t *conn,
goto done;
}
- if (global_write_bucket_low(TO_CONN(conn), size_guess, 2)) {
+ if (connection_dir_is_global_write_low(TO_CONN(conn), size_guess)) {
log_debug(LD_DIRSERV,
"Client asked for network status lists, but we've been "
"writing too many bytes lately. Sending 503 Dir busy.");
@@ -1066,7 +1066,7 @@ handle_get_status_vote(dir_connection_t *conn, const get_handler_args_t *args)
}
});
- if (global_write_bucket_low(TO_CONN(conn), estimated_len, 2)) {
+ if (connection_dir_is_global_write_low(TO_CONN(conn), estimated_len)) {
write_short_http_response(conn, 503, "Directory busy, try again later");
goto vote_done;
}
@@ -1125,7 +1125,7 @@ handle_get_microdesc(dir_connection_t *conn, const get_handler_args_t *args)
write_short_http_response(conn, 404, "Not found");
goto done;
}
- if (global_write_bucket_low(TO_CONN(conn), size_guess, 2)) {
+ if (connection_dir_is_global_write_low(TO_CONN(conn), size_guess)) {
log_info(LD_DIRSERV,
"Client asked for server descriptors, but we've been "
"writing too many bytes lately. Sending 503 Dir busy.");
@@ -1223,7 +1223,7 @@ handle_get_descriptor(dir_connection_t *conn, const get_handler_args_t *args)
msg = "Not found";
write_short_http_response(conn, 404, msg);
} else {
- if (global_write_bucket_low(TO_CONN(conn), size_guess, 2)) {
+ if (connection_dir_is_global_write_low(TO_CONN(conn), size_guess)) {
log_info(LD_DIRSERV,
"Client asked for server descriptors, but we've been "
"writing too many bytes lately. Sending 503 Dir busy.");
@@ -1319,9 +1319,8 @@ handle_get_keys(dir_connection_t *conn, const get_handler_args_t *args)
SMARTLIST_FOREACH(certs, authority_cert_t *, c,
len += c->cache_info.signed_descriptor_len);
- if (global_write_bucket_low(TO_CONN(conn),
- compress_method != NO_METHOD ? len/2 : len,
- 2)) {
+ if (connection_dir_is_global_write_low(TO_CONN(conn),
+ compress_method != NO_METHOD ? len/2 : len)) {
write_short_http_response(conn, 503, "Directory busy, try again later");
goto keys_done;
}