GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit d2947035 authored by juga  's avatar juga

chg: v3bwfile: Scale relays missing descriptor bws

Scale relays without average or observed bandwidth.
Later it will be check what to do if their values are None or 0
parent d4929161
...@@ -1335,26 +1335,18 @@ class V3BWFile(object): ...@@ -1335,26 +1335,18 @@ class V3BWFile(object):
log.debug('muf %s', muf) log.debug('muf %s', muf)
log.debug('hlimit %s', hlimit) log.debug('hlimit %s', hlimit)
for l in bw_lines_tf: for l in bw_lines_tf:
# Because earlier versions did not store this values, check first # First, obtain the observed bandwidth, later check what to do
# they exists. Do not report any error, since they will be stored # if it is 0 or None.
if not(l.desc_bw_avg):
log.debug("Skipping %s from scaling, because there was no "
"descriptor average bandwidth.", l.nick)
continue
if desc_bw_obs_type == TORFLOW_OBS_LAST: if desc_bw_obs_type == TORFLOW_OBS_LAST:
if l.desc_bw_obs_last: # In case there's no last, use the mean, because it is possible
desc_bw_obs = l.desc_bw_obs_last # that it went down for a few days, but no more than 5,
else: # otherwise the mean will be 1
log.debug("Skipping %s from scaling, because there was no " desc_bw_obs = l.desc_bw_obs_last or l.desc_bw_obs_mean
"last descriptor observed bandwidth.", l.nick) # Assume that if it is not TORFLOW_OBS_LAST, then it is
continue # TORFLOW_OBS_MEAN
elif desc_bw_obs_type == TORFLOW_OBS_MEAN: else:
if l.desc_bw_obs_mean: desc_bw_obs = l.desc_bw_obs_mean
desc_bw_obs = l.desc_bw_obs_mean
else:
log.debug("Skipping %s from scaling, because there was no "
"mean descriptor observed bandwidth.", l.nick)
continue
# Excerpt from bandwidth-file-spec.txt section 2.3 # Excerpt from bandwidth-file-spec.txt section 2.3
# A relay's MaxAdvertisedBandwidth limits the bandwidth-avg in its # A relay's MaxAdvertisedBandwidth limits the bandwidth-avg in its
# descriptor. # descriptor.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment