diff options
author | Roger Dingledine <arma@torproject.org> | 2010-01-02 13:13:30 -0500 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2010-01-02 13:13:30 -0500 |
commit | 8cba62cc2afc661f75b519f0b4ddf7c8892f15a0 (patch) | |
tree | 2aff6a8917b4bd53a7aabf241437bcf70d675e54 | |
parent | 485fa5c425e971cbd20de2b7e6e7447b5acf7f7c (diff) | |
download | tor-8cba62cc2afc661f75b519f0b4ddf7c8892f15a0.tar tor-8cba62cc2afc661f75b519f0b4ddf7c8892f15a0.tar.gz |
don't div by 0 during path selection
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/or/routerlist.c | 4 |
2 files changed, 7 insertions, 3 deletions
@@ -1,4 +1,4 @@ -Changes in version 0.2.2.7-alpha - 2009-12-?? +Changes in version 0.2.2.7-alpha - 2010-01-?? o Major features (performance): - When choosing which cells to relay first, we can now favor circuits that have been quiet recently, so as to get lower latency for @@ -67,6 +67,10 @@ Changes in version 0.2.2.7-alpha - 2009-12-?? - Fix statistics on client numbers by country as seen by bridges that were broken in 0.2.2.1-alpha. Also switch to reporting full 24-hour intervals instead of variable 12-to-48-hour intervals. + - If we're in the pathological case where there's no exit bandwidth + but there is non-exit bandwidth, or no guard bandwidth but there + is non-guard bandwidth, don't crash during path selection. Bugfix + on 0.2.0.3-alpha. o Removed features: - Remove the HSAuthorityRecordStats option that version 0 hidden diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 029bd9a0c..72b890b9f 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1698,12 +1698,12 @@ smartlist_choose_by_bandwidth(smartlist_t *sl, bandwidth_weight_rule_t rule, * For detailed derivation of this formula, see * http://archives.seul.org/or/dev/Jul-2007/msg00056.html */ - if (rule == WEIGHT_FOR_EXIT) + if (rule == WEIGHT_FOR_EXIT || !total_exit_bw) exit_weight = 1.0; else exit_weight = 1.0 - all_bw/(3.0*exit_bw); - if (rule == WEIGHT_FOR_GUARD) + if (rule == WEIGHT_FOR_GUARD || !total_guard_bw) guard_weight = 1.0; else guard_weight = 1.0 - all_bw/(3.0*guard_bw); |