Further reduce heap allocs (#56)

* work on tracking more heap allocations down

* write own heapless IP AppendFormatAddr functions

* remove potential Error method allocations

* more logging
This commit is contained in:
Pat Whittingslow
2026-03-15 00:11:59 +01:00
committed by GitHub
parent de2e756628
commit 376e1a0b4f
8 changed files with 245 additions and 23 deletions
+4 -4
View File
@@ -187,19 +187,19 @@ func (tfrm Frame) String() string {
func (tfrm Frame) ValidateSize(v *lneto.Validator) {
off := tfrm.HeaderLength()
if off < sizeHeaderTCP {
v.AddBitPosErr(12*8, 4, lneto.ErrInvalidLengthField)
v.AddError(lneto.ErrInvalidLengthField)
}
if off > len(tfrm.RawData()) {
v.AddBitPosErr(12*8, 4, lneto.ErrInvalidLengthField)
v.AddError(lneto.ErrShortBuffer)
}
}
func (tfrm Frame) ValidateExceptCRC(v *lneto.Validator) {
tfrm.ValidateSize(v)
if tfrm.DestinationPort() == 0 {
v.AddBitPosErr(2*8, 16, lneto.ErrZeroDestination)
v.AddError(lneto.ErrZeroDestination)
}
if tfrm.SourcePort() == 0 {
v.AddBitPosErr(0, 16, lneto.ErrZeroSource)
v.AddError(lneto.ErrZeroSource)
}
}