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

[tor-commits] [stem/master] Storing a single IPv6 default exit policy



commit a0ce8664bc5758030c912456fcf2ff33a619373f
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Mon Oct 7 22:11:44 2013 -0700

    Storing a single IPv6 default exit policy
    
    Each server descriptor constructed its own default value for the IPv6 exit
    policy, which was foolish. ExitPolicy instances are read-only instances, so all
    descriptors might as well use the same default. This saves roughly 2.3 MB of
    memory when downloading all of the current server descriptors (or roughly 3%).
---
 stem/descriptor/server_descriptor.py |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py
index f320008..79af0cc 100644
--- a/stem/descriptor/server_descriptor.py
+++ b/stem/descriptor/server_descriptor.py
@@ -81,6 +81,8 @@ SINGLE_FIELDS = (
   "ntor-onion-key",
 )
 
+DEFAULT_IPV6_EXIT_POLICY = stem.exit_policy.MicroExitPolicy("reject 1-65535")
+
 
 def _parse_file(descriptor_file, is_bridge = False, validate = True, **kwargs):
   """
@@ -242,7 +244,7 @@ class ServerDescriptor(Descriptor):
     self.operating_system = None
     self.uptime = None
     self.exit_policy = None
-    self.exit_policy_v6 = stem.exit_policy.MicroExitPolicy("reject 1-65535")
+    self.exit_policy_v6 = DEFAULT_IPV6_EXIT_POLICY
     self.family = set()
 
     self.average_bandwidth = None



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