diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-10-19 17:33:23 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-10-19 17:33:23 +0200 |
commit | 020bf2d0379c12fddeea362f45198c8acba7e8e3 (patch) | |
tree | 0e96ec989f49169eca478c9c34845169a9c43036 /module/network/HTTPDownload.py | |
parent | new hoster: uploadking.com, uploadhere.com (diff) | |
download | pyload-020bf2d0379c12fddeea362f45198c8acba7e8e3.tar.xz |
closed #404
Diffstat (limited to 'module/network/HTTPDownload.py')
-rw-r--r-- | module/network/HTTPDownload.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/module/network/HTTPDownload.py b/module/network/HTTPDownload.py index 3edf56d98..1a2886332 100644 --- a/module/network/HTTPDownload.py +++ b/module/network/HTTPDownload.py @@ -136,8 +136,7 @@ class HTTPDownload(): #remove old handles for chunk in self.chunks: - self.m.remove_handle(chunk.c) - chunk.close() + self.closeChunk(chunk) return self._download(chunks, False) else: @@ -211,7 +210,7 @@ class HTTPDownload(): curl, errno, msg = c #test if chunk was finished, otherwise raise the exception if errno != 23 or "0 !=" not in msg: - raise + raise pycurl.error(errno, msg) #@TODO KeyBoardInterrupts are seen as finished chunks, #but normally not handled to this process, only in the testcase @@ -266,11 +265,18 @@ class HTTPDownload(): if self.progressNotify: self.progressNotify(self.percent) + def closeChunk(self, chunk): + try: + self.m.remove_handle(chunk.c) + except pycurl.error: + self.log.debug("Error removing chunk") + finally: + chunk.close() + def close(self): """ cleanup """ for chunk in self.chunks: - self.m.remove_handle(chunk.c) - chunk.close() + self.closeChunk(chunk) self.chunks = [] if hasattr(self, "m"): |