mirror of
https://github.com/XTLS/REALITY.git
synced 2026-09-30 19:07:59 +03:00
crypto/tls: increase readFromUntil buffer size
CL 739980 switched from using a special reader to directly using the buffer backing memory to read into, but inadvertantly reduced the size of the buffer that we read into in some circumstances, which could result in more smaller reads. Switch back to reading into the largest buffer that we can. Change-Id: Ic59fe54af6fc671c28a398288bbe603a58cac7e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/769400 Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com> Auto-Submit: Roland Shoemaker <roland@golang.org> Reviewed-by: Neal Patel <nealpatel@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Daniel McCarney <daniel@binaryparadox.net> Reviewed-by: Filippo Valsorda <filippo@golang.org>
This commit is contained in:
@@ -854,7 +854,7 @@ func (c *Conn) readFromUntil(r io.Reader, n int) error {
|
||||
// for how much to read ahead.
|
||||
c.rawInput.Grow(needs + bytes.MinRead)
|
||||
for {
|
||||
buf := c.rawInput.AvailableBuffer()[:needs+bytes.MinRead]
|
||||
buf := c.rawInput.AvailableBuffer()[:c.rawInput.Available()]
|
||||
n, err := r.Read(buf)
|
||||
// This write is just to update the internal state of the
|
||||
// rawInput bytes.Buffer. It cannot fail.
|
||||
|
||||
Reference in New Issue
Block a user