Skip to content

Commit

Permalink
refactor: inline connectionTracker.performFlowWalk
Browse files Browse the repository at this point in the history
  • Loading branch information
rade committed Jul 30, 2017
1 parent b93b19a commit e77d40f
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions probe/endpoint/connection_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e77d40f

Please sign in to comment.