dashboard / go-rsync-receiver / fix: close read readers #45 rss

open · opened on 2025-01-21T15:08:10Z by erock
Help
# add changes to patch request
git format-patch main --stdout | ssh pr.pico.sh pr add 45
# add review to patch request
git format-patch main --stdout | ssh pr.pico.sh pr add --review 45
# remove patchset
ssh pr.pico.sh ps rm ps-x
# checkout all patches
ssh pr.pico.sh pr print 45 | git am -3
# print a diff between the last two patches in a patch request
ssh pr.pico.sh pr diff 45
# accept PR
ssh pr.pico.sh pr accept 45
# close PR
ssh pr.pico.sh pr close 45

Logs

erock created pr with ps-96 on 2025-01-21T15:08:10Z

Patchsets

ps-96 by erock on 2025-01-21T15:08:10Z

Patchset ps-96

fix: close read readers

Eric Bower
2024-07-09T01:59:33Z
utils/fs.go
+6 -1
Back to top

fix: close read readers

rsyncsender/sender.go link
+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
 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 }