diff --git a/plugins/analysis/dashboard/recorded_events.go b/plugins/analysis/dashboard/recorded_events.go index 2d1750672bd8f126d98fd1bdbfdf61a33f9125de..89a97d5cefec4264a188315398a638d2951b9e9e 100644 --- a/plugins/analysis/dashboard/recorded_events.go +++ b/plugins/analysis/dashboard/recorded_events.go @@ -25,6 +25,7 @@ var ( lock sync.RWMutex ) +// NeighborMetric contains the number of inbound/outbound neighbors. type NeighborMetric struct { Inbound uint Outbound uint @@ -35,7 +36,7 @@ func NumOfNeighbors() map[string]*NeighborMetric { lock.RLock() defer lock.RUnlock() result := make(map[string]*NeighborMetric) - for nodeID, _ := range nodes { + for nodeID := range nodes { // number of outgoing neighbors if _, exist := result[nodeID]; !exist { result[nodeID] = &NeighborMetric{Outbound: uint(len(links[nodeID]))} @@ -44,7 +45,7 @@ func NumOfNeighbors() map[string]*NeighborMetric { } // fill in incoming neighbors - for outNeighborID, _ := range links[nodeID] { + for outNeighborID := range links[nodeID] { if _, exist := result[outNeighborID]; !exist { result[outNeighborID] = &NeighborMetric{Inbound: 1} } else { @@ -60,13 +61,13 @@ func NetworkGraph() *graph.Graph { lock.RLock() defer lock.RUnlock() var nodeIDs []string - for id, _ := range nodes { + for id := range nodes { nodeIDs = append(nodeIDs, id) } g := graph.New(nodeIDs) for src, trgMap := range links { - for dst, _ := range trgMap { + for dst := range trgMap { g.AddEdge(src, dst) } } diff --git a/plugins/analysis/server/plugin.go b/plugins/analysis/server/plugin.go index 12821d3331c980618f4d303ca13a6ab39ff0293e..668308c82e2faf21287cafce649ad10487392025 100644 --- a/plugins/analysis/server/plugin.go +++ b/plugins/analysis/server/plugin.go @@ -86,7 +86,7 @@ func run(_ *node.Plugin) { func HandleConnection(conn *network.ManagedConnection) { err := conn.SetReadTimeout(IdleTimeout) if err != nil { - log.Debugw("Error setting read timeout; closing connection", "err", err) + log.Warnw("Error setting read timeout; closing connection", "err", err) _ = conn.Close() return } @@ -103,7 +103,7 @@ func HandleConnection(conn *network.ManagedConnection) { buffer := make([]byte, 2048) _, err := conn.Read(buffer) if err != nil && err != io.EOF && !strings.Contains(err.Error(), "use of closed network connection") { - log.Debugw("Read error", "err", err) + log.Warnw("Read error", "err", err) } // always close the connection when we've stopped reading from it _ = conn.Close()