Skip to content

Commit

Permalink
Merge pull request #1829 from Lvnszn/fix/getty-eof
Browse files Browse the repository at this point in the history
fix: fix unit test
  • Loading branch information
LaurenceLiZhixin authored Apr 15, 2022
2 parents b4558b6 + 5ecfd19 commit 0f77532
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion protocol/dubbo/impl/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (c *ProtocolCodec) Decode(p *DubboPackage) error {
return err
}
}
if c.reader.Size() < p.GetBodyLen() {
if c.reader.Size() < p.GetBodyLen()+HEADER_LENGTH {
return hessian.ErrBodyNotEnough
}
body, err := c.reader.Peek(p.GetBodyLen())
Expand Down
4 changes: 2 additions & 2 deletions remoting/getty/readwriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ func testDecodeTCPPackage(t *testing.T, svr *Server, client *Client) {
assert.True(t, incompletePkgLen >= impl.HEADER_LENGTH, "header buffer too short")
incompletePkg := pkgBytes[0 : incompletePkgLen-1]
pkg, pkgLen, err := pkgReadHandler.Read(nil, incompletePkg)
assert.NoError(t, err)
assert.Equal(t, pkg, nil)
assert.Equal(t, err.Error(), "body buffer too short")
assert.Equal(t, pkg.(*remoting.DecodeResult).Result, nil)
assert.Equal(t, pkgLen, 0)
}

Expand Down

0 comments on commit 0f77532

Please sign in to comment.