summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/tcp
diff options
context:
space:
mode:
authorMithun Iyer <iyerm@google.com>2019-11-22 12:53:49 -0800
committergVisor bot <gvisor-bot@google.com>2019-11-22 13:15:33 -0800
commitf27f38d13717a25721efb2b37fabadae5c34e374 (patch)
tree7bd4c4d14cc7dc9788c78b2a1da2078a0f972e4f /pkg/tcpip/transport/tcp
parent07635d20d40e1a279c4b063abaaad51048400ed7 (diff)
Add segment dequeue check while emptying segment queue.
PiperOrigin-RevId: 282023891
Diffstat (limited to 'pkg/tcpip/transport/tcp')
-rw-r--r--pkg/tcpip/transport/tcp/connect.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/tcpip/transport/tcp/connect.go b/pkg/tcpip/transport/tcp/connect.go
index 364067731..75b7c0828 100644
--- a/pkg/tcpip/transport/tcp/connect.go
+++ b/pkg/tcpip/transport/tcp/connect.go
@@ -1368,8 +1368,11 @@ func (e *endpoint) protocolMainLoop(handshake bool) *tcpip.Error {
// unlocks e.mu. Now that no new segments can get enqueued to this
// endpoint, try to re-match the segment to a different endpoint
// as the current endpoint is closed.
- for !e.segmentQueue.empty() {
+ for {
s := e.segmentQueue.dequeue()
+ if s == nil {
+ break
+ }
e.tryDeliverSegmentFromClosedEndpoint(s)
}