Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit dece9b3

Browse files
author
Juanjo Alvarez
committed
Fixes from review
Signed-off-by: Juanjo Alvarez <[email protected]>
1 parent 7388b75 commit dece9b3

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

internal/sockstate/netstat_darwin.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build darwin
2+
13
package sockstate
24

35
import "github.com/sirupsen/logrus"

internal/sockstate/netstat_linux.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build linux
2+
13
package sockstate
24

35
// Taken (simplified and with utility functions added) from https://github.com/cakturk/go-netstat
@@ -129,7 +131,7 @@ func parseAddr(s string) (*sockAddr, error) {
129131
case ipv4StrLen:
130132
ip, err = parseIPv4(fields[0])
131133
default:
132-
log.Fatal("Bad formatted string")
134+
log.Fatal("Badly formatted connection address:", s)
133135
}
134136
if err != nil {
135137
return nil, err

internal/sockstate/netstat_windows.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build windows
2+
13
package sockstate
24

35
import "github.com/sirupsen/logrus"

internal/sockstate/sockstate.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ func GetInodeSockState(port int, inode uint64) (SockState, error) {
6969
case 1:
7070
if socks[0].State == CloseWait {
7171
return Broken, nil
72-
} else {
73-
return Other, nil
7472
}
73+
return Other, nil
7574
default: // more than one sock for inode, impossible?
7675
return Error, ErrMultipleSocketsForInode.New()
7776
}

0 commit comments

Comments
 (0)