[tor-commits] [stem/master] Incorrect exit port counts in example script

atagar at torproject.org atagar at torproject.org
Wed Dec 27 17:46:15 UTC 2017


commit 7ff56164b83e5ba98f52cb1d1fbf0f830163aabc
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Dec 27 09:45:35 2017 -0800

    Incorrect exit port counts in example script
    
    Another catch by toralf. Pity I don't have an exit to test this on...
---
 docs/_static/example/relay_connections.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/docs/_static/example/relay_connections.py b/docs/_static/example/relay_connections.py
index 5b80caf8..55bd8919 100755
--- a/docs/_static/example/relay_connections.py
+++ b/docs/_static/example/relay_connections.py
@@ -110,8 +110,9 @@ def main():
     total_ipv4, total_ipv6 = 0, 0
 
     for port in sorted(exit_connections):
-      ipv4_count = len([conn for conn in exit_connections if is_valid_ipv4_address(conn.remote_address)])
-      ipv6_count = len(exit_connections) - ipv4_count
+      connections = exit_connections[port]
+      ipv4_count = len([conn for conn in connections if is_valid_ipv4_address(conn.remote_address)])
+      ipv6_count = len(connections) - ipv4_count
       total_ipv4, total_ipv6 = total_ipv4 + ipv4_count, total_ipv6 + ipv6_count
 
       usage = port_usage(port)



More information about the tor-commits mailing list