From 18cefb5fc5992c362e3a19e44c2bfc2f22930515 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 13 Mar 2011 19:28:21 +0100 Subject: make sure everything is written to disk before merging --- module/network/HTTPDownload.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'module/network') diff --git a/module/network/HTTPDownload.py b/module/network/HTTPDownload.py index ad6312508..295c8f465 100644 --- a/module/network/HTTPDownload.py +++ b/module/network/HTTPDownload.py @@ -17,7 +17,7 @@ @author: RaNaN """ -from os import remove +from os import remove, fsync from time import sleep, time from shutil import move @@ -212,6 +212,8 @@ class HTTPDownload(): failed = e.code remove(self.info.getChunkName(chunk.id)) + chunk.fp.flush() + fsync(chunk.fp) #make sure everything was written to disk chunk.fp.close() #needs to be closed, or merging chunks will fail if failed: raise BadHeader(failed) -- cgit v1.2.3