[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [sbws/master] new: relaylist: Count consensus timestamps



commit 021716b7791bb32caa509681d0cce08258673686
Author: juga0 <juga@xxxxxxxxxx>
Date:   Fri Feb 15 13:51:19 2019 +0000

    new: relaylist: Count consensus timestamps
    
    that have been seen for a relay and for the relay list.
    
    Part of #28566.
---
 sbws/lib/relaylist.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py
index bee0a14..4cac543 100644
--- a/sbws/lib/relaylist.py
+++ b/sbws/lib/relaylist.py
@@ -205,6 +205,11 @@ class Relay:
         self._add_consensus_timestamp(timestamp)
         self._remove_old_consensus_timestamps()
 
+    @property
+    def consensus_count(self):
+        """Number of times the relay was in a conensus."""
+        return len(self._consensus_timestamps)
+
     def can_exit_to_port(self, port):
         """
         Returns True if the relay has an exit policy and the policy accepts
@@ -363,6 +368,11 @@ class RelayList:
         # Set a new list of relays.
         self._relays = self._init_relays()
 
+    @property
+    def consensus_count(self):
+        """Number of times a new consensus was obtained."""
+        return len(self._consensus_timestamps)
+
     def exits_not_bad_allowing_port(self, port):
         return [r for r in self.exits
                 if r.is_exit_not_bad_allowing_port(port)]



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits