sftpd: remove unused expectedSize field from Transfer struct
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
cfa710037c
commit
15298b0409
4 changed files with 1 additions and 11 deletions
|
@ -60,11 +60,6 @@ func (c Connection) Fileread(request *sftp.Request) (io.ReaderAt, error) {
|
|||
return nil, vfs.GetSFTPError(c.fs, err)
|
||||
}
|
||||
|
||||
fi, err := c.fs.Stat(p)
|
||||
if err != nil {
|
||||
return nil, vfs.GetSFTPError(c.fs, err)
|
||||
}
|
||||
|
||||
file, r, cancelFn, err := c.fs.Open(p)
|
||||
if err != nil {
|
||||
c.Log(logger.LevelWarn, logSender, "could not open file %#v for reading: %+v", p, err)
|
||||
|
@ -91,7 +86,6 @@ func (c Connection) Fileread(request *sftp.Request) (io.ReaderAt, error) {
|
|||
transferError: nil,
|
||||
isFinished: false,
|
||||
minWriteOffset: 0,
|
||||
expectedSize: fi.Size(),
|
||||
isExcludedFromQuota: c.User.IsFileExcludedFromQuota(request.Filepath),
|
||||
lock: new(sync.Mutex),
|
||||
}
|
||||
|
|
|
@ -274,7 +274,6 @@ func TestReadWriteErrors(t *testing.T) {
|
|||
transferError: nil,
|
||||
isFinished: false,
|
||||
minWriteOffset: 0,
|
||||
expectedSize: 10,
|
||||
lock: new(sync.Mutex),
|
||||
}
|
||||
err = file.Close()
|
||||
|
@ -285,7 +284,7 @@ func TestReadWriteErrors(t *testing.T) {
|
|||
_, err = transfer.ReadAt(buf, 0)
|
||||
assert.Error(t, err, "reading from a closed file must fail")
|
||||
err = transfer.Close()
|
||||
assert.Error(t, err, "upoload must fail: the expected size does not match")
|
||||
assert.Error(t, err)
|
||||
|
||||
r, _, err := pipeat.Pipe()
|
||||
assert.NoError(t, err)
|
||||
|
@ -374,7 +373,6 @@ func TestTransferCancelFn(t *testing.T) {
|
|||
transferError: nil,
|
||||
isFinished: false,
|
||||
minWriteOffset: 0,
|
||||
expectedSize: 10,
|
||||
lock: new(sync.Mutex),
|
||||
}
|
||||
errFake := errors.New("fake error, this will trigger cancelFn")
|
||||
|
|
|
@ -512,7 +512,6 @@ func (c *scpCommand) handleDownload(filePath string) error {
|
|||
transferError: nil,
|
||||
isFinished: false,
|
||||
minWriteOffset: 0,
|
||||
expectedSize: stat.Size(),
|
||||
lock: new(sync.Mutex),
|
||||
}
|
||||
addTransfer(&transfer)
|
||||
|
|
|
@ -43,7 +43,6 @@ type Transfer struct {
|
|||
protocol string
|
||||
transferError error
|
||||
minWriteOffset int64
|
||||
expectedSize int64
|
||||
initialSize int64
|
||||
lock *sync.Mutex
|
||||
isNewFile bool
|
||||
|
|
Loading…
Reference in a new issue