Убрал ненужные задержки
parent
01e590c8e5
commit
27da35cc4d
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="script.module.pyrrent2http" name="pyrrent2http" version="0.7.1" provider-name="inpos">
|
<addon id="script.module.pyrrent2http" name="pyrrent2http" version="0.7.2" provider-name="inpos">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.14.0"/>
|
<import addon="xbmc.python" version="2.14.0"/>
|
||||||
<import addon="script.module.libtorrent" />
|
<import addon="script.module.libtorrent" />
|
||||||
|
|
|
@ -40,5 +40,4 @@ PeerInfo = namedtuple('PeerInfo', "ip, flags, source, up_speed, down_speed, tota
|
||||||
"country, client")
|
"country, client")
|
||||||
|
|
||||||
from engine import Engine
|
from engine import Engine
|
||||||
from platform import Platform
|
|
||||||
from error import Error
|
from error import Error
|
||||||
|
|
|
@ -235,7 +235,7 @@ class Engine:
|
||||||
self.pyrrent2http_loop.start()
|
self.pyrrent2http_loop.start()
|
||||||
|
|
||||||
|
|
||||||
start = time.time()
|
'''start = time.time()
|
||||||
self.started = True
|
self.started = True
|
||||||
initialized = False
|
initialized = False
|
||||||
while (time.time() - start) < self.startup_timeout:
|
while (time.time() - start) < self.startup_timeout:
|
||||||
|
@ -251,7 +251,7 @@ class Engine:
|
||||||
|
|
||||||
if not initialized:
|
if not initialized:
|
||||||
self.started = False
|
self.started = False
|
||||||
raise Error("Can't start pyrrent2http, time is out", Error.TIMEOUT)
|
raise Error("Can't start pyrrent2http, time is out", Error.TIMEOUT)'''
|
||||||
self._log("pyrrent2http successfully started.")
|
self._log("pyrrent2http successfully started.")
|
||||||
|
|
||||||
def check_torrent_error(self, status=None):
|
def check_torrent_error(self, status=None):
|
||||||
|
@ -354,7 +354,7 @@ class Engine:
|
||||||
|
|
||||||
:param wait_timeout: Time in seconds to wait until pyrrent2http client shut down
|
:param wait_timeout: Time in seconds to wait until pyrrent2http client shut down
|
||||||
"""
|
"""
|
||||||
self.wait_on_close_timeout = wait_timeout
|
#self.wait_on_close_timeout = wait_timeout
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""
|
"""
|
||||||
|
@ -364,7 +364,7 @@ class Engine:
|
||||||
if self.is_alive():
|
if self.is_alive():
|
||||||
self._log("Shutting down pyrrent2http...")
|
self._log("Shutting down pyrrent2http...")
|
||||||
self.pyrrent2http.shutdown()
|
self.pyrrent2http.shutdown()
|
||||||
finished = False
|
'''finished = False
|
||||||
if self.wait_on_close_timeout is not None:
|
if self.wait_on_close_timeout is not None:
|
||||||
start = time.time()
|
start = time.time()
|
||||||
while (time.time() - start) < self.wait_on_close_timeout:
|
while (time.time() - start) < self.wait_on_close_timeout:
|
||||||
|
@ -376,7 +376,8 @@ class Engine:
|
||||||
self._log("PANIC: Timeout occurred while shutting down pyrrent2http thread")
|
self._log("PANIC: Timeout occurred while shutting down pyrrent2http thread")
|
||||||
else:
|
else:
|
||||||
self._log("pyrrent2http successfully shut down.")
|
self._log("pyrrent2http successfully shut down.")
|
||||||
self.wait_on_close_timeout = None
|
self.wait_on_close_timeout = None'''
|
||||||
|
self._log("pyrrent2http successfully shut down.")
|
||||||
self.started = False
|
self.started = False
|
||||||
self.logpipe = None
|
self.logpipe = None
|
||||||
self.process = None
|
self.process = None
|
||||||
|
|
|
@ -441,7 +441,7 @@ def HttpHandlerFactory():
|
||||||
chunk = end_range - start_range
|
chunk = end_range - start_range
|
||||||
buf = bytearray(chunk)
|
buf = bytearray(chunk)
|
||||||
try:
|
try:
|
||||||
f.Read(buf)
|
count = f.Read(buf)
|
||||||
self.wfile.write(buf)
|
self.wfile.write(buf)
|
||||||
except:
|
except:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue