summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-03-12 00:08:13 +0000
committergVisor bot <gvisor-bot@google.com>2020-03-12 00:08:13 +0000
commitd023476dc92493b7458d68243081b253d151e0c3 (patch)
treea53e2734cec93a5626c9debfa585dc77562803a4 /pkg
parent58ed1682aa76559f4e85960f1a96f9cb5238fec8 (diff)
parent81675b850e27ea9d6c853a73bd667fc16901a5e8 (diff)
Merge release-20200219.0-150-g81675b8 (automated)
Diffstat (limited to 'pkg')
-rw-r--r--pkg/tcpip/transport/tcp/connect.go1
-rw-r--r--pkg/tcpip/transport/tcp/endpoint.go4
2 files changed, 4 insertions, 1 deletions
diff --git a/pkg/tcpip/transport/tcp/connect.go b/pkg/tcpip/transport/tcp/connect.go
index c0f73ef16..be86af502 100644
--- a/pkg/tcpip/transport/tcp/connect.go
+++ b/pkg/tcpip/transport/tcp/connect.go
@@ -1639,6 +1639,7 @@ func (e *endpoint) doTimeWait() (twReuse func()) {
const timeWaitDone = 3
s := sleep.Sleeper{}
+ defer s.Done()
s.AddWaker(&e.newSegmentWaker, newSegment)
s.AddWaker(&e.notificationWaker, notification)
diff --git a/pkg/tcpip/transport/tcp/endpoint.go b/pkg/tcpip/transport/tcp/endpoint.go
index dc9c18b6f..cf73f5382 100644
--- a/pkg/tcpip/transport/tcp/endpoint.go
+++ b/pkg/tcpip/transport/tcp/endpoint.go
@@ -862,7 +862,6 @@ func (e *endpoint) closeNoShutdown() {
e.closed = true
// Either perform the local cleanup or kick the worker to make sure it
// knows it needs to cleanup.
- tcpip.AddDanglingEndpoint(e)
switch e.EndpointState() {
// Sockets in StateSynRecv state(passive connections) are closed when
// the handshake fails or if the listening socket is closed while
@@ -876,6 +875,9 @@ func (e *endpoint) closeNoShutdown() {
// do nothing.
default:
e.workerCleanup = true
+ tcpip.AddDanglingEndpoint(e)
+ // Worker will remove the dangling endpoint when the endpoint
+ // goroutine terminates.
e.notifyProtocolGoroutine(notifyClose)
}