Skip to content

Commit bcca20e

Browse files
authored
Merge pull request #5 from bill-rich/allow_oversized_read
Allow oversize reads and return EOF error
2 parents e3a860b + 888b535 commit bcca20e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

disk_buffer_reader.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (dbr *DiskBufferReader) Read(out []byte) (int, error) {
5353

5454
// Will need the difference of the requested bytes and how many are read.
5555
bytesToRead := int(int64(outLen) + dbr.index - dbr.bytesRead)
56-
if bytesToRead <= 0 || bytesToRead > len(out) {
56+
if bytesToRead <= 0 {
5757
return 0, fmt.Errorf("unexpected number of new bytes to read. Expected 0 < n <= %d. Got n=%d", len(out), bytesToRead)
5858
}
5959
readerBytes := make([]byte, bytesToRead)
@@ -98,9 +98,6 @@ func (dbr *DiskBufferReader) Reset() error {
9898

9999
// Seek sets the offset for the next Read or Write to offset.
100100
func (dbr *DiskBufferReader) Seek(offset int64, whence int) (int64, error) {
101-
if !dbr.recording {
102-
return 0, fmt.Errorf("can not reset disk buffer reader after disk buffering is stopped")
103-
}
104101
switch whence {
105102
case io.SeekStart:
106103
switch {

0 commit comments

Comments
 (0)