aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-08-24 10:50:48 +0000
committerRoger Dingledine <arma@torproject.org>2007-08-24 10:50:48 +0000
commitdaece599a1bc44bcc12f5c705625f04a21cf4f8e (patch)
treeac14197fbc76a19379f85544820f714be6234416
parent738ecba367af855ac6bafd0a80947a05dff32575 (diff)
downloadtor-daece599a1bc44bcc12f5c705625f04a21cf4f8e.tar.gz
tor-daece599a1bc44bcc12f5c705625f04a21cf4f8e.zip
more cleanups on r11258. looks good now.
svn:r11266
-rw-r--r--ChangeLog10
-rw-r--r--src/or/routerlist.c30
2 files changed, 17 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index fd4fce3e86..e97b06ec74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,11 +8,11 @@ Changes in version 0.2.0.6-alpha - 2007-??-??
proportionally less, since they already have enough load. Patch
from Mike Perry.
- Raise the "max believable bandwidth" from 1.5MB/s to 10MB/s. This
- will allow fast Tor servers to get more attention. Also, when we're
- upgrading from an old Tor version, forget our current guards and
- pick new ones according to the new weightings. The resulting load
- balancing improvement could raise effective network capacity by
- a factor of four. Thanks to Mike Perry for measurements.
+ will allow fast Tor servers to get more attention.
+ - When we're upgrading from an old Tor version, forget our current
+ guards and pick new ones according to the new weightings. These
+ three load balancing patches could raise effective network capacity
+ by a factor of four. Thanks to Mike Perry for measurements.
o Major bugfixes:
- Handle unexpected whitespace better in malformed descriptors. Bug
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index c439d48f18..629e717150 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -1287,8 +1287,6 @@ get_max_believable_bandwidth(void)
* some in the list because they exit to obscure ports. If not <b>for_exit</b>,
* we're picking a non-exit node: weight exit-node's bandwidth less
* depending on the smallness of the fraction of Exit-to-total bandwidth.
- * Beware: this flag is often abused to force uniform selection when
- * we are not actually choosing exits!
*
* If <b>for_guard</b>, we're picking a guard node: consider all guard's
* bandwidth equally. Otherwise, weight guards proportionally less.
@@ -1358,18 +1356,14 @@ smartlist_choose_by_bandwidth(smartlist_t *sl, int for_exit, int for_guard,
/* if they claim something huge, don't believe it */
if (this_bw > max_believable_bw) {
char fp[HEX_DIGEST_LEN+1];
- if (status) {
- base16_encode(fp, sizeof(fp),
- status->identity_digest, DIGEST_LEN);
- } else if (router) {
- base16_encode(fp, sizeof(fp),
- router->cache_info.identity_digest, DIGEST_LEN);
- }
- log_notice(LD_DIR,
- "Bandwidth %d for router %s (%s) exceeds allowed max %d, capping",
- this_bw, router ? router->nickname : "(null)",
- status || router ? fp : "0",
- max_believable_bw);
+ base16_encode(fp, sizeof(fp), statuses ?
+ status->identity_digest :
+ router->cache_info.identity_digest,
+ DIGEST_LEN);
+ log_fn(LOG_PROTOCOL_WARN, LD_DIR,
+ "Bandwidth %d for router %s (%s) exceeds allowed max %d, capping",
+ this_bw, router ? router->nickname : "(null)",
+ fp, max_believable_bw);
this_bw = max_believable_bw;
}
if (is_known) {
@@ -1473,10 +1467,10 @@ smartlist_choose_by_bandwidth(smartlist_t *sl, int for_exit, int for_guard,
", guard bw = "U64_FORMAT
", nonguard bw = "U64_FORMAT", guard weight = %lf "
"(for guard == %d)",
- U64_PRINTF_ARG(total_bw),
- U64_PRINTF_ARG(total_exit_bw), U64_PRINTF_ARG(total_nonexit_bw),
+ U64_PRINTF_ARG(total_bw),
+ U64_PRINTF_ARG(total_exit_bw), U64_PRINTF_ARG(total_nonexit_bw),
exit_weight, for_exit,
- U64_PRINTF_ARG(total_guard_bw), U64_PRINTF_ARG(total_nonguard_bw),
+ U64_PRINTF_ARG(total_guard_bw), U64_PRINTF_ARG(total_nonguard_bw),
guard_weight, for_guard);
/* Almost done: choose a random value from the bandwidth weights. */
@@ -1495,7 +1489,7 @@ smartlist_choose_by_bandwidth(smartlist_t *sl, int for_exit, int for_guard,
tmp += ((uint64_t)(bandwidths[i] * guard_weight));
else if (is_exit)
tmp += ((uint64_t)(bandwidths[i] * exit_weight));
- else
+ else
tmp += bandwidths[i];
if (tmp >= rand_bw)