From da8671622b26a46653074847a47800079a9b8f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 5 Aug 2026 10:47:57 +0800 Subject: [PATCH] Fix InputPackets exceeding device batch size --- device/send.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/device/send.go b/device/send.go index f5561d7..034aa95 100644 --- a/device/send.go +++ b/device/send.go @@ -447,6 +447,7 @@ type InputPacketRef struct { func (device *Device) InputPackets(packets []*InputPacketRef) []*InputPacketRef { var unmatched []*InputPacketRef + batchSize := device.BatchSize() elemsByPeer := make(map[*Peer][]*QueueOutboundElementsContainer, len(packets)) for _, packetRef := range packets { peer := device.allowedips.Lookup(packetRef.Destination) @@ -475,7 +476,7 @@ func (device *Device) InputPackets(packets []*InputPacketRef) []*InputPacketRef } elem.packet = packet[:n] containers := elemsByPeer[peer] - if len(containers) == 0 || len(containers[len(containers)-1].elems) >= conn.IdealBatchSize { + if len(containers) == 0 || len(containers[len(containers)-1].elems) >= batchSize { containers = append(containers, device.GetOutboundElementsContainer()) elemsByPeer[peer] = containers }