commit 7789c793c8409da95240414dd45d3e8093d80db9 Author: juga0 juga@riseup.net Date: Fri Nov 23 10:25:39 2018 +0000
v3bwfile: Move comment about MaxAdvertisedBandwidth
from sbws scaling to torflow's scaling, where the descriptor bandwidth is calculated from the minimum of all the descriptor bandwidth values. And use the bandwidth-file-spec.txt text instead. --- sbws/lib/v3bwfile.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py index db3c2d8..e08ef28 100644 --- a/sbws/lib/v3bwfile.py +++ b/sbws/lib/v3bwfile.py @@ -605,17 +605,6 @@ class V3BWFile(object): the bandwidth to obtain the new bandwidth :returns list: V3BwLine list """ - # If a relay has MaxAdvertisedBandwidth set, they may be capable of - # some large amount of bandwidth but prefer if they didn't receive it. - # We also could have managed to measure them faster than their - # {,Relay}BandwidthRate somehow. - # - # See https://github.com/pastly/simple-bw-scanner/issues/155 and - # https://trac.torproject.org/projects/tor/ticket/8494 - # - # Note how this isn't some measured-by-us average of bandwidth. It's - # the first value on the 'bandwidth' line in the relay's server - # descriptor. log.debug('Scaling bandwidth using sbws method.') m = median([l.bw for l in bw_lines]) bw_lines_scaled = copy.deepcopy(bw_lines) @@ -827,6 +816,15 @@ class V3BWFile(object): desc_bw_obs = l.desc_bw_obs_last elif desc_bw_obs_type == TORFLOW_OBS_MEAN: desc_bw_obs = l.desc_bw_obs_mean + # Excerpt from bandwidth-file-spec.txt section 2.3 + # A relay's MaxAdvertisedBandwidth limits the bandwidth-avg in its + # descriptor. + # Therefore generators MUST limit a relay's measured bandwidth to + # its descriptor's bandwidth-avg. + # Generators SHOULD NOT limit measured bandwidths based on + # descriptors' bandwidth-observed, because that penalises new + # relays. + # See https://trac.torproject.org/projects/tor/ticket/8494 # just applying the formula above: desc_bw = min(desc_bw_obs, l.desc_bw_bur, l.desc_bw_avg) bw_new = kb_round_x_sig_dig(