diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-09-14 19:30:01 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-09-14 19:30:01 +0200 |
commit | 937a7a12afa6dde464d08e1ed7a8006e168dd6d1 (patch) | |
tree | 488c2ffa898619fa0545319922ba4c35bf1e1a37 /module/plugins/hooks/ClickAndLoad.py | |
parent | missing file, again.. (diff) | |
download | pyload-937a7a12afa6dde464d08e1ed7a8006e168dd6d1.tar.xz |
cnl cpu usage fix
Diffstat (limited to 'module/plugins/hooks/ClickAndLoad.py')
-rw-r--r-- | module/plugins/hooks/ClickAndLoad.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index fcbb27c21..f0372dbf8 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -41,18 +41,18 @@ class ClickAndLoad(Hook): else: ip = "127.0.0.1" - thread.start_new_thread(proxy, (ip, self.port, 9666)) + thread.start_new_thread(proxy, (self, ip, self.port, 9666)) except: self.log.error("ClickAndLoad port already in use.") -def proxy(*settings): - thread.start_new_thread(server, settings) +def proxy(self, *settings): + thread.start_new_thread(server, (self,)+settings) lock = thread.allocate_lock() lock.acquire() lock.acquire() -def server(*settings): +def server(self, *settings): try: dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) dock_socket.bind((settings[0], settings[2])) @@ -63,10 +63,13 @@ def server(*settings): server_socket.connect(("127.0.0.1", settings[1])) thread.start_new_thread(forward, (client_socket, server_socket)) thread.start_new_thread(forward, (server_socket, client_socket)) + except socket.error, e: + if e.errno == 98: + self.core.log.warning(_("Click'N'Load: Port 9666 already in use")) + return + thread.start_new_thread(server, (self,)+settings) except: - pass - finally: - thread.start_new_thread(server, settings) + thread.start_new_thread(server, (self,)+settings) def forward(source, destination): string = ' ' |