commit 0c6b4e34306fb4de93f2321525db3642126335ec Author: David Fifield david@bamsoftware.com 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@lists.torproject.org