mirror of
https://github.com/soypat/lneto.git
synced 2026-08-22 07:29:04 +00:00
Reduce heap allocations (#42)
* pcap: reuse Frame memory * slog: reduce heap allocations of addresses; also prevent heap alloc of dhcp options in pcap * dns: heapless improvement; add StackAsync buffer for more heapless operation; start thinking of errors * reuse function for reclaiming frames among all protocols for lower memory usage * remove extraneous code
This commit is contained in:
+3
-1
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
"math"
|
||||
"math/bits"
|
||||
"net"
|
||||
@@ -220,7 +221,8 @@ func (c *Client) Demux(carrierData []byte, frameOffset int) error {
|
||||
|
||||
msgOK := msgType == MsgOffer || msgType == MsgAck
|
||||
if !msgOK {
|
||||
return fmt.Errorf("invalid DHCP message received or none got=%d", msgType)
|
||||
internal.LogAttrs(nil, slog.LevelError, "invalid DHCP message", slog.Uint64("type", uint64(msgType)))
|
||||
return lneto.ErrBug
|
||||
}
|
||||
err = c.setOptions(frm)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user