summaryrefslogtreecommitdiffstats
path: root/pyLoadCore.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyLoadCore.py')
-rw-r--r--pyLoadCore.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/pyLoadCore.py b/pyLoadCore.py
index 85ca5a5fe..c5bf7ed0a 100644
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -161,10 +161,9 @@ class Core(object):
while True:
sleep(2)
- if self.do_kill:
+ if self.do_kill:
+ self.shutdown()
self.logger.info("pyLoad quits")
- self.webserver.quit()
- self.webserver.join()
exit()
def init_server(self):
@@ -312,7 +311,17 @@ class Core(object):
else: return False
def getMaxSpeed(self):
- return self.downloadSpeedLimit
+ return self.downloadSpeedLimit
+
+ def shutdown(self):
+ self.logger.info("shutting down...")
+ self.webserver.quit()
+ self.webserver.join()
+ self.thread_list.stopAllDownloads()
+ for thread in self.thread_list.threads:
+ thread.shutdown = True
+ thread.join(15)
+ self.file_list.save()
####################################
########## XMLRPC Methods ##########
@@ -511,7 +520,8 @@ if __name__ == "__main__":
pyload_core = Core()
try:
pyload_core.start()
- except KeyboardInterrupt:
+ except KeyboardInterrupt:
+ pyload_core.shutdown()
pyload_core.logger.info("killed pyLoad by Terminal")
exit()