summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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)
}