Skip to content

Commit

Permalink
Do not return EOF immediately in HttpChunkedReader
Browse files Browse the repository at this point in the history
  • Loading branch information
devgianlu committed Sep 25, 2023
1 parent bdb3a0a commit 336a836
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion audio/chunked_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,17 @@ func (r *HttpChunkedReader) Read(p []byte) (n int, err error) {

func (r *HttpChunkedReader) ReadAt(p []byte, pos int64) (n int, _ error) {
chunkIdx, off := int(pos/DefaultChunkSize), int(pos%DefaultChunkSize)
if chunkIdx >= len(r.chunks) {
return 0, io.EOF
}

// start prefetching next chunks
r.prefetchChunks(chunkIdx)

n = 0
for len(p) > 0 {
if chunkIdx >= len(r.chunks) {
return n, io.EOF
return n, nil
}

// get the chunk data
Expand Down

0 comments on commit 336a836

Please sign in to comment.