summaryrefslogtreecommitdiffstats
path: root/module/network
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-03-13 19:28:21 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-03-13 19:28:21 +0100
commit18cefb5fc5992c362e3a19e44c2bfc2f22930515 (patch)
treed893abe6a2fa2ec1a8fa38af5cced5f168379f77 /module/network
parentfixed gzip (diff)
downloadpyload-18cefb5fc5992c362e3a19e44c2bfc2f22930515.tar.xz
make sure everything is written to disk before merging
Diffstat (limited to 'module/network')
-rw-r--r--module/network/HTTPDownload.py4
1 files changed, 3 insertions, 1 deletions
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)