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

[tor-commits] [stem/master] Avoiding address type query for cached get_mask() requests



commit 9c0cc18909a1dd16cc810cf3178acfbcb0bc064f
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Fri Dec 7 07:22:43 2012 -0800

    Avoiding address type query for cached get_mask() requests
    
    Oops. There's no reason to call get_address_type() when we already have a
    lazily loaded _mask attribute.
---
 stem/exit_policy.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/stem/exit_policy.py b/stem/exit_policy.py
index f9f0eb8..6aaa4cc 100644
--- a/stem/exit_policy.py
+++ b/stem/exit_policy.py
@@ -489,9 +489,9 @@ class ExitPolicyRule(object):
     # Lazy loading our mask because it very infrequently requested. There's
     # no reason to usually usse memory for it.
     
-    address_type = self.get_address_type()
-    
     if not self._mask:
+      address_type = self.get_address_type()
+      
       if address_type == AddressType.WILDCARD:
         mask = None
       elif address_type == AddressType.IPv4:



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