Skip to content

Commit 3b495de

Browse files
committed
Use config limit for flush events
1 parent 0b4a38c commit 3b495de

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

executor/executor.go

+14
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,14 @@ func (e *Executor) monitor() {
204204
if !e.shouldSendIPPacket(ippacket) {
205205
continue
206206
}
207+
208+
e.mx.Lock()
207209
e.ipbuf.Write(ippacket)
210+
l := e.ipbuf.Len()
211+
e.mx.Unlock()
212+
if l >= e.cfg.IPEvents.BufferSize {
213+
go e.sendIPPackets()
214+
}
208215
}
209216
case "dns":
210217
if e.cfg.Engine.Analyze.DNS {
@@ -222,7 +229,14 @@ func (e *Executor) monitor() {
222229
if !e.shouldSendDNSPacket(dnspacket) {
223230
continue
224231
}
232+
e.mx.Lock()
225233
e.dnsbuf.Write(dnspacket)
234+
l := e.dnsbuf.Len()
235+
e.mx.Unlock()
236+
if l >= e.cfg.DNSEvents.BufferSize {
237+
// do not wait for sending packets
238+
go e.sendDNSPackets()
239+
}
226240
}
227241
}
228242
}

0 commit comments

Comments
 (0)