diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-01-22 22:21:23 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-01-22 22:21:23 +0100 |
commit | 4dc4268919d29de81679c99173b39529d8e41f44 (patch) | |
tree | acbdf01d0390053bd4c70d075a59ea74f421755c /module | |
parent | fixes for chunked download (diff) | |
download | pyload-4dc4268919d29de81679c99173b39529d8e41f44.tar.xz |
added missing curl.close
Diffstat (limited to 'module')
-rw-r--r-- | module/PluginThread.py | 2 | ||||
-rw-r--r-- | module/network/HTTPDownload.py | 7 | ||||
-rw-r--r-- | module/network/HTTPRequest.py | 4 | ||||
-rw-r--r-- | module/pyunrar.py | 6 |
4 files changed, 14 insertions, 5 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py index f31aa43f8..216f59853 100644 --- a/module/PluginThread.py +++ b/module/PluginThread.py @@ -220,6 +220,8 @@ class DownloadThread(PluginThread): code = 0 msg = e.args + self.m.log.debug("pycurl exception %s: %s" % (code, msg)) + 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 diff --git a/module/network/HTTPDownload.py b/module/network/HTTPDownload.py index 8bc2c7645..5f3302ce2 100644 --- a/module/network/HTTPDownload.py +++ b/module/network/HTTPDownload.py @@ -97,6 +97,9 @@ class HTTPDownload(): fo.write(data) fi.close() if fo.tell() < self.info.getChunkRange(i)[1]: + fo.close() + remove(init) + self.info.remove() #there are probably invalid chunks raise Exception("Downloaded content was smaller than expected") remove(fname) #remove chunk fo.close() @@ -230,8 +233,10 @@ class HTTPDownload(): chunk.close() self.m.remove_handle(chunk.c) - self.m.close() self.chunks = [] + if hasattr(self, "m"): + self.m.close() + del self.m if hasattr(self, "cj"): del self.cj if hasattr(self, "info"): diff --git a/module/network/HTTPRequest.py b/module/network/HTTPRequest.py index e107831cd..fa34ad5b3 100644 --- a/module/network/HTTPRequest.py +++ b/module/network/HTTPRequest.py @@ -163,7 +163,8 @@ class HTTPRequest(): """ raise an exceptions on bad headers """ code = int(self.c.getinfo(pycurl.RESPONSE_CODE)) if code in range(400,404) or code in range(405,418) or code in range(500,506): - raise BadHeader(code) #404 will NOT raise an exception + #404 will NOT raise an exception + raise BadHeader(code) return code def getResponse(self): @@ -195,6 +196,7 @@ class HTTPRequest(): if hasattr(self, "cj"): del self.cj if hasattr(self, "c"): + self.c.close() del self.c diff --git a/module/pyunrar.py b/module/pyunrar.py index a01cb633a..d873ef9bc 100644 --- a/module/pyunrar.py +++ b/module/pyunrar.py @@ -292,11 +292,11 @@ class Unrar(): if self.ram: size = self.biggestFiles["size"] / 1024 ** 2 - if self.ram < 127 and size > 100: + if self.ram < 127 and size > 500: raise LowRamError - elif self.ram < 256 and size > 300: + elif self.ram < 256 and size > 1000: raise LowRamError - elif self.ram < 512 and size > 2000: + elif self.ram < 512 and size > 5000: raise LowRamError tdir = self.tmpdir |