Skip to content

Commit f51b2f9

Browse files
committed
fsync file on receive chunk
1 parent 9baae84 commit f51b2f9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

filereceiver.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ func saveFile(path string, offset int64, length int64, r io.Reader, log log.Logg
154154
}
155155
w := io.MultiWriter(f, fi.Digest.CRC32, fi.Digest.Sha1)
156156
n, _ := io.Copy(w, r)
157+
err = f.Sync()
158+
if err != nil {
159+
return nil, err
160+
}
157161
err = f.Close()
158162
if err != nil {
159163
return nil, err

0 commit comments

Comments
 (0)