feed: make non-blocking, engine: move around dispatch call for perf
This commit is contained in:
+5
-6
@@ -99,14 +99,13 @@ func (e *engine) dispatch(p io.Packet) bool {
|
||||
_ = e.io.SetVerdict(p, io.VerdictAcceptStream, nil)
|
||||
return true
|
||||
}
|
||||
// Load balance by stream ID
|
||||
index := p.StreamID() % uint32(len(e.workers))
|
||||
packet := gopacket.NewPacket(data, layerType, gopacket.DecodeOptions{Lazy: true, NoCopy: true})
|
||||
e.workers[index].Feed(&workerPacket{
|
||||
StreamID: p.StreamID(),
|
||||
Packet: packet,
|
||||
SrcMAC: srcMAC,
|
||||
DstMAC: dstMAC,
|
||||
StreamID: p.StreamID(),
|
||||
Data: data,
|
||||
LayerType: layerType,
|
||||
SrcMAC: srcMAC,
|
||||
DstMAC: dstMAC,
|
||||
SetVerdict: func(v io.Verdict, b []byte) error {
|
||||
return e.io.SetVerdict(p, v, b)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user