[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [sbws/master] fix: v3bwfile: Add method to set under_min_report KeyValue
commit ab41332191f75fa4f050e072a2b37254267a8f3d
Author: juga0 <juga@xxxxxxxxxx>
Date: Fri Mar 22 16:56:01 2019 +0000
fix: v3bwfile: Add method to set under_min_report KeyValue
in the Bandwidth Lines.
When the minimum percent of relays it's not reached, still report
the relays but set KeyValues accordingly so that Tor doesn't vote
on their bandwidth.
Part of #29853.
---
sbws/lib/v3bwfile.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py
index e698388..d126ad6 100644
--- a/sbws/lib/v3bwfile.py
+++ b/sbws/lib/v3bwfile.py
@@ -978,6 +978,17 @@ class V3BWFile(object):
return cls(header, bw_lines)
@staticmethod
+ def set_under_min_report(bw_lines):
+ """
+ Mondify the Bandwidth Lines adding the KeyValue `under_min_report`,
+ `vote`.
+ """
+ log.debug("Setting `under_min_report` to %s lines.", len(bw_lines))
+ for l in bw_lines:
+ l.under_min_report = 1
+ l.vote = 0
+
+ @staticmethod
def bw_kb(bw_lines, reverse=False):
bw_lines_scaled = copy.deepcopy(bw_lines)
for l in bw_lines_scaled:
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits