diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-09-20 21:12:38 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-09-20 21:12:38 +0000 |
commit | 6aff7497a5bafa21b693f8affc07091b21f67d13 (patch) | |
tree | 2f21f6ddfe70def59d7b5cca1d159192311efcc7 /pkg/p9/transport_flipcall.go | |
parent | 8fe1a00617f99318bf253956d20313807fb6d851 (diff) | |
parent | 002f1d4aaefa9abdd50e3e8906ae828c31d038e6 (diff) |
Merge release-20190806.1-164-g002f1d4 (automated)
Diffstat (limited to 'pkg/p9/transport_flipcall.go')
-rwxr-xr-x | pkg/p9/transport_flipcall.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/pkg/p9/transport_flipcall.go b/pkg/p9/transport_flipcall.go index aebb54959..7cdf4ecc3 100755 --- a/pkg/p9/transport_flipcall.go +++ b/pkg/p9/transport_flipcall.go @@ -60,6 +60,7 @@ type channel struct { // -- client only -- connected bool + active bool // -- server only -- client *fd.FD @@ -197,10 +198,18 @@ func (ch *channel) recv(r message, rsz uint32) (message, error) { return nil, &ErrBadResponse{Got: t, Want: r.Type()} } - // Is there a payload? Set to the latter portion. + // Is there a payload? Copy from the latter portion. if payloader, ok := r.(payloader); ok { fs := payloader.FixedSize() - payloader.SetPayload(ch.buf.data[fs:]) + p := payloader.Payload() + payloadData := ch.buf.data[fs:] + if len(p) < len(payloadData) { + p = make([]byte, len(payloadData)) + copy(p, payloadData) + payloader.SetPayload(p) + } else if n := copy(p, payloadData); n < len(p) { + payloader.SetPayload(p[:n]) + } ch.buf.data = ch.buf.data[:fs] } |