Files
lneto/internet/definitions_tinygo.go
T
Pat Whittingslow 989bb6a0b9 Reduce heap allocs 2 (#46)
* reduce heap allocations in tcp logging; omit use of AppendFloat which allocates a metric sh*tton

* debugheaplog: better heap statistic logging

* heap: use string for pcap.Frame.Protocol

* add potential to eliminate Flags.String heap alloc, remove incorrect HEAP comments

* add StackAsync.DebugErr and httpraw.SetBytes

* many heap alloc reductions and replacement of bytes.Equal with internal.BytesEqual
2026-02-28 15:20:46 -03:00

31 lines
749 B
Go

//go:build tinygo
package internet
func makecbnode(s StackNode) cbnode {
return cbnode{
_demux: s.Demux,
_encapsulate: s.Encapsulate,
}
}
type cbnode struct {
// Do not access outside of handlers/node logic.
_demux func([]byte, int) error
// Do not access outside of handlers/node logic.
_encapsulate func([]byte, int, int) (int, error)
}
func (s *cbnode) Encapsulate(carrierData []byte, offsetToIP, offsetToFrame int) (int, error) {
return s._encapsulate(carrierData, offsetToIP, offsetToFrame)
}
func (s *cbnode) Demux(carrierData []byte, frameOffset int) error {
debugLog("cbnode:pre-demux")
return s._demux(carrierData, frameOffset)
}
func (s cbnode) IsZeroed() bool {
return s._demux == nil || s._encapsulate == nil
}