diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-18 17:27:18 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-18 17:27:18 +0200 |
commit | 9f8090483e8a7d9d20fd98e3f4b1fbbe640af7a4 (patch) | |
tree | 0645653314fd9b9c09e8561e3e714f42b4d48524 /module | |
parent | Set broken plugins (diff) | |
download | pyload-9f8090483e8a7d9d20fd98e3f4b1fbbe640af7a4.tar.xz |
[ClickNLoad] Don't sleep, use scheduling
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/hooks/ClickNLoad.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/module/plugins/hooks/ClickNLoad.py b/module/plugins/hooks/ClickNLoad.py index fa99ac12c..6179e17f2 100644 --- a/module/plugins/hooks/ClickNLoad.py +++ b/module/plugins/hooks/ClickNLoad.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import socket +import threading import time try: @@ -8,8 +9,6 @@ try: except ImportError: pass -from threading import Lock - from module.plugins.internal.Addon import Addon, threaded @@ -22,7 +21,6 @@ def forward(source, destination): bufdata = source.recv(bufsize) finally: destination.shutdown(socket.SHUT_WR) - #: destination.close() #@TODO: IPv6 support @@ -51,7 +49,7 @@ class ClickNLoad(Addon): webport = self.pyload.config.get("webinterface", "port") cnlport = self.get_config('port') - self.proxy(ip, webport, cnlport) + self.pyload.scheduler.addJob(5, self.proxy, [ip, webport, cnlport], threaded=False) @threaded @@ -69,13 +67,11 @@ class ClickNLoad(Addon): @threaded def proxy(self, ip, webport, cnlport): - time.sleep(10) #@TODO: Remove in 0.4.10 (implement addon delay on startup) - self.log_info(_("Proxy listening on %s:%s") % (ip or "0.0.0.0", cnlport)) self._server(ip, webport, cnlport) - lock = Lock() + lock = threading.Lock() lock.acquire() lock.acquire() |