diff --git a/cmd/bitrot-streaming.go b/cmd/bitrot-streaming.go index edf3f1106..d707c70e2 100644 --- a/cmd/bitrot-streaming.go +++ b/cmd/bitrot-streaming.go @@ -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 diff --git a/cmd/xl-storage.go b/cmd/xl-storage.go index 9ae4a356b..63b3ff488 100644 --- a/cmd/xl-storage.go +++ b/cmd/xl-storage.go @@ -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 != "" {