Skip to content

Commit

Permalink
service/content: fix logic error on storing extra data
Browse files Browse the repository at this point in the history
Clarify logic that extra data is stored when the target
buffer is full. Existing logic allows for extra data to
be stored even when more data will be read into buffer
when the remaining space is less than what was copied
from the last receive.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
  • Loading branch information
dmcgowan committed Jun 5, 2017
1 parent bf2fee2 commit 73763b9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions services/content/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ func (rr *remoteReader) Read(p []byte) (n int, err error) {
n += copied
p = p[copied:]

if copied < len(p) {
continue
if len(p) == 0 {
rr.extra = append(rr.extra, resp.Data[copied:]...)
}

rr.extra = append(rr.extra, resp.Data[copied:]...)
}

return
Expand Down

0 comments on commit 73763b9

Please sign in to comment.