diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-01-16 00:07:58 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-01-16 00:07:58 +0000 |
commit | 06bcbc23fd8a186b0314fc8aae50545a972d7f5c (patch) | |
tree | 082d2058c07b5b9cb3e31e515519dd21d2269734 /pkg/tcpip/buffer | |
parent | 0b4604d503bfac4dfccd6f0b7e34b55dc2c9e36d (diff) | |
parent | 12d9790833cc2f6a9b197066a5ecbeb434f74164 (diff) |
Merge release-20210112.0-37-g12d979083 (automated)
Diffstat (limited to 'pkg/tcpip/buffer')
-rw-r--r-- | pkg/tcpip/buffer/view.go | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/pkg/tcpip/buffer/view.go b/pkg/tcpip/buffer/view.go index 09d3dac66..91cc62cc8 100644 --- a/pkg/tcpip/buffer/view.go +++ b/pkg/tcpip/buffer/view.go @@ -148,23 +148,13 @@ func (vv *VectorisedView) ReadToVV(dstVV *VectorisedView, count int) (copied int // ReadTo reads up to count bytes from vv to dst. It also removes them from vv // unless peek is true. -func (vv *VectorisedView) ReadTo(dst io.Writer, count int, peek bool) (int, error) { +func (vv *VectorisedView) ReadTo(dst io.Writer, peek bool) (int, error) { var err error done := 0 for _, v := range vv.Views() { - remaining := count - done - if remaining <= 0 { - break - } - if len(v) > remaining { - v = v[:remaining] - } - var n int n, err = dst.Write(v) - if n > 0 { - done += n - } + done += n if err != nil { break } |