summaryrefslogtreecommitdiffstats
path: root/module/PluginThread.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-12-27 21:18:29 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-12-27 21:18:29 +0100
commit9509a6444bbb538e136ed899d94aab32be629383 (patch)
treeac8532b20912a3e5be6ff73443520a7f31f5806a /module/PluginThread.py
parentencoding fix (diff)
downloadpyload-9509a6444bbb538e136ed899d94aab32be629383.tar.xz
new curl download backend - support for chunked dl, resume
Diffstat (limited to 'module/PluginThread.py')
-rw-r--r--module/PluginThread.py24
1 files changed, 8 insertions, 16 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py
index 3f24db345..f72e94eaf 100644
--- a/module/PluginThread.py
+++ b/module/PluginThread.py
@@ -29,8 +29,7 @@ from sys import exc_info, exc_clear
from types import MethodType
from os.path import join, exists
-from urllib2 import URLError
-from socket import error
+from pycurl import error
from module.plugins.Plugin import Abort
from module.plugins.Plugin import Fail
@@ -215,20 +214,14 @@ class DownloadThread(PluginThread):
continue
except error, e:
- #@TODO determine correct error codes
- if len(e.args) > 1:
- code = e.args[0]
- msg = e.args[1:]
- else:
- code = -1
+ try:
+ code, msg = e.args
+ except:
+ code = 0
msg = e.args
- if "timed out" in msg:
- code = 990
-
- self.m.log.debug("socket error %s: %s" % (code, msg))
- if code in (104, 990):
- self.m.log.warning(_("Couldn't connect to host or connection resetted, waiting 1 minute and retry."))
+ if code in (7, 18, 28, 52, 56):
+ self.m.log.warning(_("Couldn't connect to host or connection resetted waiting 1 minute and retry."))
wait = time() + 60
while time() < wait:
sleep(1)
@@ -241,14 +234,13 @@ class DownloadThread(PluginThread):
self.clean(pyfile)
else:
- pyfile.plugin.req.canContinue = False
self.queue.put(pyfile)
continue
else:
pyfile.setStatus("failed")
- self.m.log.error("socket error %s: %s" % (code, msg))
+ self.m.log.error("pycurl error %s: %s" % (code, msg))
if self.m.core.debug:
print_exc()
self.writeDebugReport(pyfile)