From f27f38d13717a25721efb2b37fabadae5c34e374 Mon Sep 17 00:00:00 2001 From: Mithun Iyer Date: Fri, 22 Nov 2019 12:53:49 -0800 Subject: Add segment dequeue check while emptying segment queue. PiperOrigin-RevId: 282023891 --- pkg/tcpip/transport/tcp/connect.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pkg/tcpip/transport') 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) } -- cgit v1.2.3