diff options
Diffstat (limited to 'module')
| -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"): | 
