Skip to content

Commit

Permalink
fix incorrect read bytes count
Browse files Browse the repository at this point in the history
  • Loading branch information
fionera committed Feb 16, 2024
1 parent ac05ebd commit 12191b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spop/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (f *frame) ReadFrom(r io.Reader) (int64, error) {
return int64(n + len(f.length)), io.ErrUnexpectedEOF
}

return int64(n + len(f.length)), f.decodeHeader()
return int64(uint32Len + n + len(f.length)), f.decodeHeader()
}

func (f *frame) WriteTo(w io.Writer) (int64, error) {
Expand All @@ -76,7 +76,7 @@ func (f *frame) WriteTo(w io.Writer) (int64, error) {
}

n, err := w.Write(f.buf.ReadBytes())
return int64(n + len(f.length)), err
return int64(uint32Len + n + len(f.length)), err
}

func (f *frame) encodeHeader() error {
Expand Down

0 comments on commit 12191b7

Please sign in to comment.