diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2020-07-12 17:20:50 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-07-12 17:22:08 -0700 |
commit | 9c32fd3f4d8f6e63d922c1c58b7d1f1f504fa2bc (patch) | |
tree | dfb5150ec211a268f9f69bfc22d0ba3ecf0795dc /pkg/tcpip/stack | |
parent | 69f2059e5d38bacac4bcda7912cca580ab70914d (diff) |
Do not copy sleep.Waker
sleep.Waker's fields are modified as values.
PiperOrigin-RevId: 320873451
Diffstat (limited to 'pkg/tcpip/stack')
-rw-r--r-- | pkg/tcpip/stack/packet_buffer.go | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/pkg/tcpip/stack/packet_buffer.go b/pkg/tcpip/stack/packet_buffer.go index 1b5da6017..e3556d5d2 100644 --- a/pkg/tcpip/stack/packet_buffer.go +++ b/pkg/tcpip/stack/packet_buffer.go @@ -14,6 +14,7 @@ package stack import ( + "gvisor.dev/gvisor/pkg/sync" "gvisor.dev/gvisor/pkg/tcpip" "gvisor.dev/gvisor/pkg/tcpip/buffer" ) @@ -24,7 +25,7 @@ import ( // multiple endpoints. Clone() should be called in such cases so that // modifications to the Data field do not affect other copies. type PacketBuffer struct { - _ noCopy + _ sync.NoCopy // PacketBufferEntry is used to build an intrusive list of // PacketBuffers. @@ -102,14 +103,3 @@ func (pk *PacketBuffer) Clone() *PacketBuffer { NatDone: pk.NatDone, } } - -// noCopy may be embedded into structs which must not be copied -// after the first use. -// -// See https://golang.org/issues/8005#issuecomment-190753527 -// for details. -type noCopy struct{} - -// Lock is a no-op used by -copylocks checker from `go vet`. -func (*noCopy) Lock() {} -func (*noCopy) Unlock() {} |