Add round-robin implementation (#66)

* add handler.encapsulateNode

* implement round robin handler approach

* simplify round robin implementation

* leave TODO

* internet.node touch up

* fix conflict resolve f-up

* replace certain ErrShortBuffer with ErrTruncatedFrame error
This commit is contained in:
Pat Whittingslow
2026-04-09 09:36:17 -03:00
committed by GitHub
parent ec44889896
commit 63f7870fe5
21 changed files with 104 additions and 70 deletions
+3 -3
View File
@@ -12,13 +12,13 @@ const (
sizeHeaderTCP = 20
)
// NewFrame returns a new TCPFrame with data set to buf.
// NewFrame returns a new [Frame] with data set to buf.
// An error is returned if the buffer size is smaller than 20.
// Users should still call [Frame.ValidateSize] before working
// with payload/options of frames to avoid panics.
func NewFrame(buf []byte) (Frame, error) {
if len(buf) < sizeHeaderTCP {
return Frame{buf: nil}, lneto.ErrShortBuffer
return Frame{buf: nil}, lneto.ErrTruncatedFrame
}
return Frame{buf: buf}, nil
}
@@ -190,7 +190,7 @@ func (tfrm Frame) ValidateSize(v *lneto.Validator) {
v.AddError(lneto.ErrInvalidLengthField)
}
if off > len(tfrm.RawData()) {
v.AddError(lneto.ErrShortBuffer)
v.AddError(lneto.ErrTruncatedFrame)
}
}