Add a panic that prints information about the sender before calling splitSeg.

Calling splitSeg with a negative value panics anyway, we need to know why.

PiperOrigin-RevId: 455455562
This commit is contained in:
Lucas Manning
2022-06-16 13:35:34 -07:00
committed by gVisor bot
parent 7ef9f97f41
commit 35227fb84f
+7
View File
@@ -859,6 +859,13 @@ func (s *sender) maybeSendSegment(seg *segment, limit int, end seqnum.Value) (se
}
if seg.payloadSize() > available {
// A negative value causes splitSeg to panic anyways, so just panic
// earlier to get more information about the cause.
// TOOD(b/236090764): Remove this panic once the cause of negative values
// of "available" is understood.
if available < 0 {
panic(fmt.Sprintf("got available=%d, want available>=0. limit %d, s.MaxPayloadSize %d, seg.payloadSize() %d, gso.MaxSize %d, gso.MSS %d", available, limit, s.MaxPayloadSize, seg.payloadSize(), s.ep.gso.MaxSize, s.ep.gso.MSS))
}
s.splitSeg(seg, available)
}