diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-06-02 06:42:39 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-06-02 06:42:39 +0000 |
commit | 96421fff8e2b7e2fd9398482f39ad6a073cd4550 (patch) | |
tree | defc679c2c41d590a977b1a3b305be1c248e3524 /pkg/tcpip/transport | |
parent | 5bc83bf61ec93350a7bccfc7d5faa669d4f37c94 (diff) | |
parent | 9357b4f7eb51b78311cb7d6478d5ac3bfcf79948 (diff) |
Merge release-20210518.0-67-g9357b4f7e (automated)
Diffstat (limited to 'pkg/tcpip/transport')
-rw-r--r-- | pkg/tcpip/transport/tcp/connect.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/pkg/tcpip/transport/tcp/connect.go b/pkg/tcpip/transport/tcp/connect.go index 570e5081c..9958547d3 100644 --- a/pkg/tcpip/transport/tcp/connect.go +++ b/pkg/tcpip/transport/tcp/connect.go @@ -1474,11 +1474,19 @@ func (e *endpoint) protocolMainLoop(handshake bool, wakerInitDone chan<- struct{ return &tcpip.ErrConnectionReset{} } - if n¬ifyClose != 0 && closeTimer == nil { - if e.EndpointState() == StateFinWait2 && e.closed { + if n¬ifyClose != 0 && e.closed { + switch e.EndpointState() { + case StateEstablished: + // Perform full shutdown if the endpoint is still + // established. This can occur when notifyClose + // was asserted just before becoming established. + e.shutdownLocked(tcpip.ShutdownWrite | tcpip.ShutdownRead) + case StateFinWait2: // The socket has been closed and we are in FIN_WAIT2 // so start the FIN_WAIT2 timer. - closeTimer = e.stack.Clock().AfterFunc(e.tcpLingerTimeout, closeWaker.Assert) + if closeTimer == nil { + closeTimer = e.stack.Clock().AfterFunc(e.tcpLingerTimeout, closeWaker.Assert) + } } } |