diff --git a/concurrent_readseeker.go b/concurrent_readseeker.go index 4cb6d0b..8e8adfa 100644 --- a/concurrent_readseeker.go +++ b/concurrent_readseeker.go @@ -11,7 +11,7 @@ type concurrentReadSeeker struct { mu sync.Mutex } -func (rs *concurrentReadSeeker) New() io.ReadSeeker { +func (rs *concurrentReadSeeker) newReadSeeker() io.ReadSeeker { return &readSeeker{ parent: rs, } diff --git a/concurrent_writeseeker.go b/concurrent_writeseeker.go index bc94fbf..fb1ce12 100644 --- a/concurrent_writeseeker.go +++ b/concurrent_writeseeker.go @@ -11,7 +11,7 @@ type concurrentWriteSeeker struct { mu sync.Mutex } -func (rs *concurrentWriteSeeker) New() io.WriteSeeker { +func (rs *concurrentWriteSeeker) newWriteSeeker() io.WriteSeeker { return &writeSeeker{ parent: rs, } diff --git a/server.go b/server.go index 048699d..0ff9d2f 100644 --- a/server.go +++ b/server.go @@ -339,7 +339,7 @@ func (fs *FileServer) handleReadFile(resp http.ResponseWriter, req *http.Request if fs.allowFullGET && req.Header.Get(HeaderRange) == "" { // If the special range header is not set, treat it like a normal GET request // Serve the file with the Go http handler to support partial requests - http.ServeContent(resp, req, string(fileID), time.Now(), reader.New()) + http.ServeContent(resp, req, string(fileID), time.Now(), reader.newReadSeeker()) return } @@ -350,7 +350,7 @@ func (fs *FileServer) handleReadFile(resp http.ResponseWriter, req *http.Request resp.WriteHeader(http.StatusPartialContent) - rdr := reader.New() + rdr := reader.newReadSeeker() _, err := rdr.Seek(offset, io.SeekStart) if err != nil { fs.logger.Error("networkfile.FileServer.handleReadFile: Error seeking to offset", @@ -385,7 +385,7 @@ func (fs *FileServer) handleWriteFile(resp http.ResponseWriter, req *http.Reques return } - wrtr := writer.New() + wrtr := writer.newWriteSeeker() fs.logger.Debug("networkfile.FileServer.handleWriteFile: Seeking", "offset", offset) _, err := wrtr.Seek(offset, io.SeekStart) if err != nil {