Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
neilotoole committed Jan 25, 2024
1 parent fadd9b2 commit 115356d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions streamcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,9 @@ type Reader struct {
// returns what is available instead of waiting for more.
//
// Use io.ReadFull or io.ReadAtLeast if you want to ensure that p is filled.
//
// Read is not safe for concurrent use.
func (r *Reader) Read(p []byte) (n int, err error) {
// r.mu.Lock()
// defer r.mu.Unlock()

if r.ctx != nil {
select {
case <-r.ctx.Done():
Expand All @@ -644,9 +643,9 @@ func (r *Reader) Read(p []byte) (n int, err error) {
}

n, err = r.readFn(r, p, r.offset)

r.readErr = err
r.offset += n

return n, err
}

Expand Down

0 comments on commit 115356d

Please sign in to comment.