diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-06-17 17:52:15 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-06-17 17:52:15 +0000 |
commit | 253c71e6df0b25eef4f6edcfa070de857ed5e661 (patch) | |
tree | 7ee5528aa3b056cab62a4148f05fec3dacad8cf9 /pkg/tcpip/transport/tcp | |
parent | 82621396212fecc1b57207192a34424491333c5a (diff) | |
parent | 50afec55c75dfd5bb88d100f77e17048dfbb3322 (diff) |
Merge release-20200608.0-70-g50afec55c (automated)
Diffstat (limited to 'pkg/tcpip/transport/tcp')
-rw-r--r-- | pkg/tcpip/transport/tcp/connect.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pkg/tcpip/transport/tcp/connect.go b/pkg/tcpip/transport/tcp/connect.go index 91ee3b0be..9d4dce826 100644 --- a/pkg/tcpip/transport/tcp/connect.go +++ b/pkg/tcpip/transport/tcp/connect.go @@ -1516,6 +1516,7 @@ func (e *endpoint) protocolMainLoop(handshake bool, wakerInitDone chan<- struct{ // Main loop. Handle segments until both send and receive ends of the // connection have completed. cleanupOnError := func(err *tcpip.Error) { + e.stack.Stats().TCP.CurrentConnected.Decrement() e.workerCleanup = true if err != nil { e.resetConnectionLocked(err) @@ -1568,11 +1569,14 @@ loop: reuseTW = e.doTimeWait() } - // Mark endpoint as closed. - if e.EndpointState() != StateError { - e.transitionToStateCloseLocked() + // Handle any StateError transition from StateTimeWait. + if e.EndpointState() == StateError { + cleanupOnError(nil) + return nil } + e.transitionToStateCloseLocked() + // Lock released below. epilogue() |