summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-07-14 21:01:00 +0000
committergVisor bot <gvisor-bot@google.com>2021-07-14 21:01:00 +0000
commit0c3b1f790d7bc0c163d37d0fe2d465a729e131f7 (patch)
treeb4781cc854d8644d5f3a7623085a9dfa3481452b /pkg
parent916ad897e2a34b3bfc3e2e94de62a06c823ba35a (diff)
parente963657e7c22b3b0be78c84ec7bec28dd0fc269b (diff)
Merge release-20210705.0-23-ge963657e7 (automated)
Diffstat (limited to 'pkg')
-rw-r--r--pkg/tcpip/transport/tcp/endpoint.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/pkg/tcpip/transport/tcp/endpoint.go b/pkg/tcpip/transport/tcp/endpoint.go
index 9945fdd6b..ebc88d6c3 100644
--- a/pkg/tcpip/transport/tcp/endpoint.go
+++ b/pkg/tcpip/transport/tcp/endpoint.go
@@ -754,7 +754,7 @@ func (e *endpoint) ResumeWork() {
//
// Precondition: e.mu must be held to call this method.
func (e *endpoint) setEndpointState(state EndpointState) {
- oldstate := EndpointState(atomic.LoadUint32(&e.state))
+ oldstate := EndpointState(atomic.SwapUint32(&e.state, uint32(state)))
switch state {
case StateEstablished:
e.stack.Stats().TCP.CurrentEstablished.Increment()
@@ -771,7 +771,6 @@ func (e *endpoint) setEndpointState(state EndpointState) {
e.stack.Stats().TCP.CurrentEstablished.Decrement()
}
}
- atomic.StoreUint32(&e.state, uint32(state))
}
// EndpointState returns the current state of the endpoint.