packages/hyprspace: allocate multiple packets

This commit is contained in:
Max Headroom 2024-04-23 23:34:59 +02:00
parent 3e3eec0fb1
commit 7929c28b7d

View file

@ -177,8 +177,8 @@ func UpRun(r *cmd.Root, c *cmd.Sub) {
// Initialize active streams map and packet byte array. // Initialize active streams map and packet byte array.
activeStreams = make(map[peer.ID]MuxStream) activeStreams = make(map[peer.ID]MuxStream)
var packet = make([]byte, 1420)
for { for {
var packet = make([]byte, 1420)
// Read in a packet from the tun device. // Read in a packet from the tun device.
plen, err := tunDev.Iface.Read(packet) plen, err := tunDev.Iface.Read(packet)
if errors.Is(err, fs.ErrClosed) { if errors.Is(err, fs.ErrClosed) {