From b32353f0942de73e3776767d4aea64a9f3d6578d Mon Sep 17 00:00:00 2001 From: Alexander Blagoev Date: Thu, 4 May 2017 14:52:34 +0300 Subject: [PATCH] Add comments with a short explanation and link to the PR request --- net/net_linux.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/net_linux.go b/net/net_linux.go index 28078eb..d4f24bf 100644 --- a/net/net_linux.go +++ b/net/net_linux.go @@ -615,6 +615,10 @@ func processInet(file string, kind netConnectionKindType, inodes map[string][]in return []connTmp{}, nil } + // Read the contents of the /proc file with a single read sys call. + // This minimizes duplicates in the returned connections + // For more info: + // https://github.com/shirou/gopsutil/pull/361 contents, err := ioutil.ReadFile(file) if err != nil { return nil, err @@ -672,6 +676,10 @@ func processInet(file string, kind netConnectionKindType, inodes map[string][]in } func processUnix(file string, kind netConnectionKindType, inodes map[string][]inodeMap, filterPid int32) ([]connTmp, error) { + // Read the contents of the /proc file with a single read sys call. + // This minimizes duplicates in the returned connections + // For more info: + // https://github.com/shirou/gopsutil/pull/361 contents, err := ioutil.ReadFile(file) if err != nil { return nil, err