[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [arm/master] Removing allowConnectionTypes() helper function
commit 8cb78d0c22ed80049dcfaa6a7a4bb9b7a96e6356
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
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:
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits