aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-09-14 22:32:36 -0400
committerNick Mathewson <nickm@torproject.org>2010-09-14 22:32:36 -0400
commit6d8fc4eb3866122ef42f209cc51a875a3e438607 (patch)
tree89190e195c05359882d3ce2fbc282419eaa6d928 /src/or/routerlist.c
parent60e3def3ed7428b139cfd6e36517f930a84bd085 (diff)
downloadtor-6d8fc4eb3866122ef42f209cc51a875a3e438607.tar.gz
tor-6d8fc4eb3866122ef42f209cc51a875a3e438607.zip
Add a simple integer-ceiling-division macro before we get it wrong
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r--src/or/routerlist.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 480da44ba6..b77107ca0b 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -4220,7 +4220,7 @@ launch_router_descriptor_downloads(smartlist_t *downloadable,
pds_flags |= PDS_NO_EXISTING_SERVERDESC_FETCH;
}
- n_per_request = (n_downloadable+MIN_REQUESTS-1) / MIN_REQUESTS;
+ n_per_request = CEIL_DIV(n_downloadable, MIN_REQUESTS);
if (n_per_request > MAX_DL_PER_REQUEST)
n_per_request = MAX_DL_PER_REQUEST;
if (n_per_request < MIN_DL_PER_REQUEST)
@@ -4233,7 +4233,7 @@ launch_router_descriptor_downloads(smartlist_t *downloadable,
log_info(LD_DIR,
"Launching %d request%s for %d router%s, %d at a time",
- (n_downloadable+n_per_request-1)/n_per_request,
+ CEIL_DIV(n_downloadable, n_per_request),
req_plural, n_downloadable, rtr_plural, n_per_request);
smartlist_sort_digests(downloadable);
for (i=0; i < n_downloadable; i += n_per_request) {