in pcap-fsnotify/main.go [247:274]
func flushSrcDir(
ctx context.Context,
wg *sync.WaitGroup,
pcapDotExt *regexp.Regexp,
sync, compress, delete bool,
validator func(fs.FileInfo) bool,
) uint32 {
pendingPcapFiles := uint32(0)
if sync {
flushBuffers()
}
filepath.Walk(*src_dir, func(path string, info fs.FileInfo, err error) error {
if info.IsDir() {
return nil
}
if err != nil {
logger.LogEvent(zapcore.ErrorLevel, "failed to flush PCAP files", PCAP_FSNERR, nil, err)
return nil
}
if validator(info) {
pendingPcapFiles += 1
wg.Add(1)
go exportPcapFile(ctx, wg, pcapDotExt, &path, compress, delete, true /* flush */)
}
return nil
})
return pendingPcapFiles
}