diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-05-19 01:13:03 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-05-19 01:13:03 +0000 |
commit | d7e9ad3ba0bb573ad13934985c8f00b3d018cb4c (patch) | |
tree | e24c03a0c3737660dc022620549609ac452912ed /pkg | |
parent | ce7da5c836a10d44652122546351232e2d523f5e (diff) | |
parent | e290d33708c5415d6bc3adc53780eb801d2dda06 (diff) |
Merge release-20210510.0-57-ge290d3370 (automated)
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/tcpip/socketops.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/tcpip/socketops.go b/pkg/tcpip/socketops.go index b26936b7f..b7c2de652 100644 --- a/pkg/tcpip/socketops.go +++ b/pkg/tcpip/socketops.go @@ -222,7 +222,7 @@ type SocketOptions struct { getReceiveBufferLimits GetReceiveBufferLimits `state:"manual"` // receiveBufferSize determines the receive buffer size for this socket. - receiveBufferSize int64 + receiveBufferSize atomicbitops.AlignedAtomicInt64 // mu protects the access to the below fields. mu sync.Mutex `state:"nosave"` @@ -653,13 +653,13 @@ func (so *SocketOptions) SetSendBufferSize(sendBufferSize int64, notify bool) { // GetReceiveBufferSize gets value for SO_RCVBUF option. func (so *SocketOptions) GetReceiveBufferSize() int64 { - return atomic.LoadInt64(&so.receiveBufferSize) + return so.receiveBufferSize.Load() } // SetReceiveBufferSize sets value for SO_RCVBUF option. func (so *SocketOptions) SetReceiveBufferSize(receiveBufferSize int64, notify bool) { if !notify { - atomic.StoreInt64(&so.receiveBufferSize, receiveBufferSize) + so.receiveBufferSize.Store(receiveBufferSize) return } @@ -684,8 +684,8 @@ func (so *SocketOptions) SetReceiveBufferSize(receiveBufferSize int64, notify bo v = math.MaxInt32 } - oldSz := atomic.LoadInt64(&so.receiveBufferSize) + oldSz := so.receiveBufferSize.Load() // Notify endpoint about change in buffer size. newSz := so.handler.OnSetReceiveBufferSize(v, oldSz) - atomic.StoreInt64(&so.receiveBufferSize, newSz) + so.receiveBufferSize.Store(newSz) } |