mirror of https://github.com/minio/minio.git
use io.NopCloser replace closeWrapper (#20287)
This commit is contained in:
parent
7b239ae154
commit
1e1bd3afd9
|
@ -141,13 +141,7 @@ func (b *streamingBitrotReader) Close() error {
|
|||
}
|
||||
if closer, ok := b.rc.(io.Closer); ok {
|
||||
// drain the body for connection reuse at network layer.
|
||||
xhttp.DrainBody(struct {
|
||||
io.Reader
|
||||
io.Closer
|
||||
}{
|
||||
Reader: b.rc,
|
||||
Closer: closeWrapper(func() error { return nil }),
|
||||
})
|
||||
xhttp.DrainBody(io.NopCloser(b.rc))
|
||||
return closer.Close()
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -2079,14 +2079,6 @@ func (s *xlStorage) ReadFileStream(ctx context.Context, volume, path string, off
|
|||
return &sendFileReader{Reader: io.LimitReader(file, length), Closer: file}, nil
|
||||
}
|
||||
|
||||
// closeWrapper converts a function to an io.Closer
|
||||
type closeWrapper func() error
|
||||
|
||||
// Close calls the wrapped function.
|
||||
func (c closeWrapper) Close() error {
|
||||
return c()
|
||||
}
|
||||
|
||||
// CreateFile - creates the file.
|
||||
func (s *xlStorage) CreateFile(ctx context.Context, origvolume, volume, path string, fileSize int64, r io.Reader) (err error) {
|
||||
if origvolume != "" {
|
||||
|
|
Loading…
Reference in New Issue