mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-11-20 16:49:12 +00:00
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:
co-authored by
b84330808
anonymousmeower
parent
8e07407486
commit
f73471e6b4
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user