Add segment dequeue check while emptying segment queue.

PiperOrigin-RevId: 282023891
This commit is contained in:
Mithun Iyer
2019-11-22 13:15:33 -08:00
committed by gVisor bot
parent 07635d20d4
commit f27f38d137
+4 -1
View File
@@ -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)
}