From a799c28d059f48ec93d72c515e4ecbff3b3b8b71 Mon Sep 17 00:00:00 2001 From: mkaay Date: Sun, 19 Dec 2010 17:46:26 +0100 Subject: calc fixes --- module/network/HTTPDownload.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'module/network/HTTPDownload.py') diff --git a/module/network/HTTPDownload.py b/module/network/HTTPDownload.py index 4bba7724e..fbec872fa 100644 --- a/module/network/HTTPDownload.py +++ b/module/network/HTTPDownload.py @@ -135,8 +135,11 @@ class HTTPDownload(): @property def arrived(self): arrived = 0 - for i in range(self.info.getCount()): - arrived += getsize(self.info.getChunkName(i)) #ugly, but difficult to calc otherwise due chunk resume + try: + for i in range(self.info.getCount()): + arrived += getsize(self.info.getChunkName(i)) #ugly, but difficult to calc otherwise due chunk resume + except OSError: + arrived = self.size return arrived def abort(self): @@ -284,7 +287,7 @@ if __name__ == "__main__": print "starting" dwnld = HTTPDownload(url, "test_100mb.bin") - d = dwnld.download(chunks=2, resume=True) + d = dwnld.download(chunks=5, resume=True) d.addCallback(callb) d.addErrback(err) -- cgit v1.2.3