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

It helps to know why splitSeg panics with a negative value.

PiperOrigin-RevId: 661021651
This commit is contained in:
Jing Chen
2024-08-08 16:22:50 -07:00
committed by gVisor bot
parent 8191404896
commit 414df2de11
+5
View File
@@ -905,6 +905,11 @@ 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/357457079): 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)
}