refactor: inline connectionTracker.performFlowWalk

This commit is contained in:
Matthias Radestock
2017-07-30 09:04:34 +01:00
parent b93b19a7c7
commit e77d40fc16

View File

@@ -91,24 +91,17 @@ func (t *connectionTracker) ReportConnections(rpt *report.Report) {
t.useProcfs()
}
// seenTuples contains information about connections seen by
// conntrack
seenTuples := t.performFlowWalk(rpt)
if t.conf.WalkProc && t.conf.Scanner != nil {
t.performWalkProc(rpt, hostNodeID, seenTuples)
}
}
// performFlowWalk consults the flowWalker for short-lived connections
func (t *connectionTracker) performFlowWalk(rpt *report.Report) map[string]fourTuple {
// consult the flowWalker for short-lived (conntracked) connections
seenTuples := map[string]fourTuple{}
t.flowWalker.walkFlows(func(f flow, alive bool) {
tuple := flowToTuple(f)
seenTuples[tuple.key()] = tuple
t.addConnection(rpt, false, tuple, "", nil, nil)
})
return seenTuples
if t.conf.WalkProc && t.conf.Scanner != nil {
t.performWalkProc(rpt, hostNodeID, seenTuples)
}
}
func (t *connectionTracker) existingFlows() map[string]fourTuple {