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

[tor-commits] [flashproxy/master] Rearrange some functions around __main__.



commit 0c6b4e34306fb4de93f2321525db3642126335ec
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Mon Oct 22 23:22:56 2012 -0700

    Rearrange some functions around __main__.
---
 flashproxy-client |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/flashproxy-client b/flashproxy-client
index 088b8a7..1e32d8f 100755
--- a/flashproxy-client
+++ b/flashproxy-client
@@ -846,7 +846,7 @@ class LocalSocket(object):
     def __getattr__(self, name):
         return getattr(self.fd, name)
 
-def main():
+def proxy_loop():
     while True:
         rset = remote_listen + local_listen + websocket_pending + socks_pending + locals + remotes
         rset, _, _ = select.select(rset, [], [], WEBSOCKET_REQUEST_TIMEOUT)
@@ -932,7 +932,12 @@ def build_register_command(method):
     else:
         raise ValueError("Unknown registration method \"%s\"" % method)
 
-if __name__ == "__main__":
+def main():
+    global remote_listen, local_listen
+    global locals, remotes
+    global websocket_pending, socks_pending
+    global unlinked_locals, unlinked_remotes
+
     register_addr_spec = None
     register_methods = []
 
@@ -1044,7 +1049,10 @@ if __name__ == "__main__":
         register()
 
     try:
-        main()
+        proxy_loop()
     except Exception:
         exc = traceback.format_exc()
         log("".join(exc))
+
+if __name__ == "__main__":
+    main()

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