tiltwind commented on code in PR #2841:
URL: https://github.com/apache/dubbo-go/pull/2841#discussion_r2115000509
##########
protocol/dubbo/hessian2/hessian_dubbo.go:
##########
@@ -109,17 +120,34 @@ func (h *HessianCodec) Write(service Service, header
DubboHeader, body any) ([]b
// ReadHeader uses hessian codec to read dubbo header
func (h *HessianCodec) ReadHeader(header *DubboHeader) error {
var err error
-
- if h.reader.Size() < HEADER_LENGTH {
- return ErrHeaderNotEnough
- }
- buf, err := h.reader.Peek(HEADER_LENGTH)
- if err != nil { // this is impossible
- return perrors.WithStack(err)
- }
- _, err = h.reader.Discard(HEADER_LENGTH)
- if err != nil { // this is impossible
- return perrors.WithStack(err)
+ var buf []byte
+
+ if h.streaming {
+ buf = make([]byte, HEADER_LENGTH)
+ n, _ := h.reader.Read(buf)
Review Comment:
agree
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]