Read reads data from the testReader, simulating a slow read and a potential failure
(p []byte)
| 82 | |
| 83 | // Read reads data from the testReader, simulating a slow read and a potential failure |
| 84 | func (r *blockingReader) Read(p []byte) (n int, err error) { |
| 85 | if !r.unlocking.Load() { |
| 86 | r.mu.Lock() |
| 87 | } |
| 88 | |
| 89 | n, err = r.reader.Read(p) |
| 90 | return n, err |
| 91 | } |
| 92 | |
| 93 | func (r *blockingReader) Close() error { // Close forwards closing to the underlying reader |
| 94 | return r.reader.Close() |