Commit e0532a96 authored by juga's avatar juga
Browse files

Allow 0 RTT measurements

To speed up the scanner.
RTT is not being used at the moment, set the default to 0.
parent 1defb776
...@@ -42,7 +42,7 @@ download_min = 5 ...@@ -42,7 +42,7 @@ download_min = 5
download_target = 6 download_target = 6
download_max = 10 download_max = 10
# How many RTT measurements to make # How many RTT measurements to make
num_rtts = 10 num_rtts = 0
# Number of downloads with acceptable times we must have for a relay before # Number of downloads with acceptable times we must have for a relay before
# moving on # moving on
num_downloads = 5 num_downloads = 5
......
...@@ -476,7 +476,7 @@ class ResultSuccess(Result): ...@@ -476,7 +476,7 @@ class ResultSuccess(Result):
def from_dict(d): def from_dict(d):
assert isinstance(d, dict) assert isinstance(d, dict)
return ResultSuccess( return ResultSuccess(
d['rtts'], d['downloads'], d['rtts'] or [], d['downloads'],
Result.Relay( Result.Relay(
d['fingerprint'], d['nickname'], d['address'], d['fingerprint'], d['nickname'], d['address'],
d['master_key_ed25519'], d['relay_average_bandwidth'], d['master_key_ed25519'], d['relay_average_bandwidth'],
......
...@@ -302,7 +302,9 @@ class V3BWLine(object): ...@@ -302,7 +302,9 @@ class V3BWLine(object):
return None return None
kwargs['desc_avg_bw_bs'] = \ kwargs['desc_avg_bw_bs'] = \
results_recent[-1].relay_average_bandwidth results_recent[-1].relay_average_bandwidth
kwargs['rtt'] = cls.rtt_from_results(results_recent) rtt = cls.rtt_from_results(results_recent)
if rtt:
kwargs['rtt'] = rtt
bw = cls.bw_bs_median_from_results(results_recent) bw = cls.bw_bs_median_from_results(results_recent)
kwargs['bw_bs_mean'] = cls.bw_bs_mean_from_results(results_recent) kwargs['bw_bs_mean'] = cls.bw_bs_mean_from_results(results_recent)
kwargs['bw_bs_median'] = cls.bw_bs_median_from_results( kwargs['bw_bs_median'] = cls.bw_bs_median_from_results(
...@@ -380,7 +382,7 @@ class V3BWLine(object): ...@@ -380,7 +382,7 @@ class V3BWLine(object):
def rtt_from_results(results): def rtt_from_results(results):
# convert from miliseconds to seconds # convert from miliseconds to seconds
rtts = [(round(rtt * 1000)) for r in results for rtt in r.rtts] rtts = [(round(rtt * 1000)) for r in results for rtt in r.rtts]
rtt = round(median(rtts)) rtt = round(median(rtts)) if rtts else None
return rtt return rtt
@staticmethod @staticmethod
......
...@@ -236,7 +236,7 @@ def _validate_scanner(conf): ...@@ -236,7 +236,7 @@ def _validate_scanner(conf):
sec = 'scanner' sec = 'scanner'
err_tmpl = Template('$sec/$key ($val): $e') err_tmpl = Template('$sec/$key ($val): $e')
ints = { ints = {
'num_rtts': {'minimum': 1, 'maximum': 100}, 'num_rtts': {'minimum': 0, 'maximum': 100},
'num_downloads': {'minimum': 1, 'maximum': 100}, 'num_downloads': {'minimum': 1, 'maximum': 100},
'initial_read_request': {'minimum': 1, 'maximum': None}, 'initial_read_request': {'minimum': 1, 'maximum': None},
'measurement_threads': {'minimum': 1, 'maximum': None}, 'measurement_threads': {'minimum': 1, 'maximum': None},
......
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