gRPC transport: Pass standard size buffer (#7449)

https://github.com/XTLS/Xray-core/pull/7438#issuecomment-7008713358

Fixes https://github.com/XTLS/Xray-core/issues/7369 and https://github.com/XTLS/Xray-core/pull/7424

---------

Co-authored-by: b84330808 <b84330808@gmail.com>
Co-authored-by: anonymousmeower <arasouli@duck.com>
This commit is contained in:
风扇滑翔翼
2026-11-19 13:48:04 +00:00
committed by GitHub
co-authored by b84330808 anonymousmeower
parent 8e07407486
commit f73471e6b4
2 changed files with 3 additions and 7 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ func (h *HunkReaderWriter) ReadMultiBuffer() (buf.MultiBuffer, error) {
}
}
if cap(h.buf) >= buf.Size {
if len(h.buf) == buf.Size {
b := h.buf
h.index = len(h.buf)
return buf.MultiBuffer{buf.NewExisted(b)}, nil
@@ -74,14 +74,10 @@ func (h *MultiHunkReaderWriter) ReadMultiBuffer() (buf.MultiBuffer, error) {
continue
}
if cap(b) >= buf.Size {
if len(b) == buf.Size {
mb = append(mb, buf.NewExisted(b))
} else {
nb := buf.New()
nb.Extend(int32(len(b)))
copy(nb.Bytes(), b)
mb = append(mb, nb)
mb = buf.MergeBytes(mb, b)
}
}