commit e0532a96069c96f25d638fb9884da279225641a9 Author: juga0 juga@riseup.net Date: Tue Oct 23 12:30:32 2018 +0000
Allow 0 RTT measurements
To speed up the scanner. RTT is not being used at the moment, set the default to 0. --- sbws/config.default.ini | 2 +- sbws/lib/resultdump.py | 2 +- sbws/lib/v3bwfile.py | 6 ++++-- sbws/util/config.py | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/sbws/config.default.ini b/sbws/config.default.ini index e7950b1..93b3505 100644 --- a/sbws/config.default.ini +++ b/sbws/config.default.ini @@ -42,7 +42,7 @@ download_min = 5 download_target = 6 download_max = 10 # 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 # moving on num_downloads = 5 diff --git a/sbws/lib/resultdump.py b/sbws/lib/resultdump.py index abf45fb..22e3f3a 100644 --- a/sbws/lib/resultdump.py +++ b/sbws/lib/resultdump.py @@ -476,7 +476,7 @@ class ResultSuccess(Result): def from_dict(d): assert isinstance(d, dict) return ResultSuccess( - d['rtts'], d['downloads'], + d['rtts'] or [], d['downloads'], Result.Relay( d['fingerprint'], d['nickname'], d['address'], d['master_key_ed25519'], d['relay_average_bandwidth'], diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py index c35c865..a572625 100644 --- a/sbws/lib/v3bwfile.py +++ b/sbws/lib/v3bwfile.py @@ -302,7 +302,9 @@ class V3BWLine(object): return None kwargs['desc_avg_bw_bs'] = \ 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) kwargs['bw_bs_mean'] = cls.bw_bs_mean_from_results(results_recent) kwargs['bw_bs_median'] = cls.bw_bs_median_from_results( @@ -380,7 +382,7 @@ class V3BWLine(object): def rtt_from_results(results): # convert from miliseconds to seconds 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
@staticmethod diff --git a/sbws/util/config.py b/sbws/util/config.py index 3577c5a..8ba5aac 100644 --- a/sbws/util/config.py +++ b/sbws/util/config.py @@ -236,7 +236,7 @@ def _validate_scanner(conf): sec = 'scanner' err_tmpl = Template('$sec/$key ($val): $e') ints = { - 'num_rtts': {'minimum': 1, 'maximum': 100}, + 'num_rtts': {'minimum': 0, 'maximum': 100}, 'num_downloads': {'minimum': 1, 'maximum': 100}, 'initial_read_request': {'minimum': 1, 'maximum': None}, 'measurement_threads': {'minimum': 1, 'maximum': None},
tor-commits@lists.torproject.org