From 020bf2d0379c12fddeea362f45198c8acba7e8e3 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 19 Oct 2011 17:33:23 +0200 Subject: closed #404 --- module/network/HTTPDownload.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'module/network/HTTPDownload.py') 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"): -- cgit v1.2.3