diff --git a/reader.go b/reader.go index 53833e37..3b407ce3 100644 --- a/reader.go +++ b/reader.go @@ -70,10 +70,10 @@ func (r *reader) SetNonResponsive() { func (r *reader) SetReadahead(readahead int64) { r.mu.Lock() - defer r.mu.Unlock() r.readahead = readahead r.readaheadFunc = nil r.posChanged() + r.mu.Unlock() } // How many bytes are available to read. Max is the most we could require. @@ -248,8 +248,8 @@ func (r *reader) readOnceAt(ctx context.Context, b []byte, pos int64) (n int, er // Hodor func (r *reader) Close() error { r.t.cl.lock() - defer r.t.cl.unlock() r.t.deleteReader(r) + r.t.cl.unlock() return nil }