[tor-commits] [arm/master] Removing allowConnectionTypes() helper function

atagar at torproject.org atagar at torproject.org
Sun Sep 15 22:29:20 UTC 2013


commit 8cb78d0c22ed80049dcfaa6a7a4bb9b7a96e6356
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Sep 8 14:28:42 2013 -0700

    Removing allowConnectionTypes() helper function
    
    Flattening allowConnectionTypes() into the main method, which will make it
    easier to simplify this funcitonality.
---
 arm/starter.py |   25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/arm/starter.py b/arm/starter.py
index 7fe8d92..bae9a64 100644
--- a/arm/starter.py
+++ b/arm/starter.py
@@ -171,23 +171,6 @@ def _get_args(argv):
   return Args(**args)
 
 
-def allowConnectionTypes():
-  """
-  This provides a tuple with booleans indicating if we should or shouldn't
-  attempt to connect by various methods...
-  (allowPortConnection, allowSocketConnection)
-  """
-  
-  confKeys = stem.util.conf.get_config("arm").keys()
-  
-  isPortArgPresent = "startup.interface.ipAddress" in confKeys or "startup.interface.port" in confKeys
-  isSocketArgPresent = "startup.interface.socket" in confKeys
-  
-  skipPortConnection = isSocketArgPresent and not isPortArgPresent
-  skipSocketConnection = isPortArgPresent and not isSocketArgPresent
-  
-  return (not skipPortConnection, not skipSocketConnection)
-
 def _loadConfigurationDescriptions(pathPrefix):
   """
   Attempts to load descriptions for tor's configuration options, fetching them
@@ -448,7 +431,13 @@ def main():
   # arguments for connecting to the other.
   
   controller = None
-  allowPortConnection, allowSocketConnection = allowConnectionTypes()
+
+  confKeys = stem.util.conf.get_config("arm").keys()
+  isPortArgPresent = "startup.interface.ipAddress" in confKeys or "startup.interface.port" in confKeys
+  isSocketArgPresent = "startup.interface.socket" in confKeys
+  
+  allowPortConnection = not (isSocketArgPresent and not isPortArgPresent)
+  allowSocketConnection = not (isPortArgPresent and not isSocketArgPresent)
   
   socketPath = param["startup.interface.socket"]
   if os.path.exists(socketPath) and allowSocketConnection:





More information about the tor-commits mailing list