From e2cbe7ac261405429cb42a575eaac7eafe49887f Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Mon, 10 Jul 2017 15:09:19 +0100 Subject: [PATCH] refactor: a bit of inlining --- probe/endpoint/ebpf.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/probe/endpoint/ebpf.go b/probe/endpoint/ebpf.go index dd8119269..b6faa704b 100644 --- a/probe/endpoint/ebpf.go +++ b/probe/endpoint/ebpf.go @@ -177,13 +177,12 @@ func (t *EbpfTracker) handleFdInstall(ev tracer.EventType, pid int, fd int) { if !ok { return } - conn := ebpfConnection{ + t.openConnections[tuple] = ebpfConnection{ incoming: true, tuple: tuple, pid: pid, networkNamespace: netns, } - t.openConnections[tuple] = conn if !process.IsProcInAccept("/proc", strconv.Itoa(pid)) { t.tracer.RemoveFdInstallWatcher(uint32(pid)) } @@ -202,21 +201,19 @@ func (t *EbpfTracker) handleConnection(ev tracer.EventType, tuple fourTuple, pid switch ev { case tracer.EventConnect: - conn := ebpfConnection{ + t.openConnections[tuple] = ebpfConnection{ incoming: false, tuple: tuple, pid: pid, networkNamespace: networkNamespace, } - t.openConnections[tuple] = conn case tracer.EventAccept: - conn := ebpfConnection{ + t.openConnections[tuple] = ebpfConnection{ incoming: true, tuple: tuple, pid: pid, networkNamespace: networkNamespace, } - t.openConnections[tuple] = conn case tracer.EventClose: if deadConn, ok := t.openConnections[tuple]; ok { delete(t.openConnections, tuple)