Patchset ps-96
fix: close read readers
Eric Bower
rsyncsender/sender.go
+1
-0
utils/fs.go
+6
-1
fix: close read readers
rsyncsender/sender.go
link
+1
-0
+1
-0
1diff --git a/rsyncsender/sender.go b/rsyncsender/sender.go
2index 292b92a..5babaf1 100644
3--- a/rsyncsender/sender.go
4+++ b/rsyncsender/sender.go
5@@ -141,6 +141,7 @@ func (st *sendTransfer) sendFile(fileIndex int32, fl *utils.SenderFile) error {
6 const chunkSize = 32 * 1024
7
8 fi, f, err := st.filesystem.Read(fl)
9+ defer f.Close()
10 if err != nil {
11 return err
12 }
utils/fs.go
link
+6
-1
+6
-1
1diff --git a/utils/fs.go b/utils/fs.go
2index f129817..f446f81 100644
3--- a/utils/fs.go
4+++ b/utils/fs.go
5@@ -5,10 +5,15 @@ import (
6 "os"
7 )
8
9+type ReaderAtCloser interface {
10+ io.ReaderAt
11+ io.Closer
12+}
13+
14 // File System: need to handle all type of files: regular, folder, symlink, etc
15 type FS interface {
16 Put(*ReceiverFile) (int64, error)
17 Skip(*ReceiverFile) bool
18 List(string) ([]os.FileInfo, error)
19- Read(*SenderFile) (os.FileInfo, io.ReaderAt, error)
20+ Read(*SenderFile) (os.FileInfo, ReaderAtCloser, error)
21 }