Skip to content

Commit

Permalink
tcp stat ipv4
Browse files Browse the repository at this point in the history
  • Loading branch information
askuy committed Jun 6, 2024
1 parent 906fb4d commit 7f66ffa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/emetric/tcpstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func getTCPStats(statsFile string) (map[tcpConnectionState]map[string]float64, e

func parseTCPStats(r io.Reader) (map[tcpConnectionState]map[string]float64, error) {
//tcpStats := map[tcpConnectionState]float64{}
tcpStatsMap := map[tcpConnectionState]map[string]float64{}
tcpStatsMap := make(map[tcpConnectionState]map[string]float64, 0)
contents, err := io.ReadAll(r)
if err != nil {
return nil, err
Expand Down Expand Up @@ -169,6 +169,7 @@ func parseTCPStats(r io.Reader) (map[tcpConnectionState]map[string]float64, erro

info, flag := tcpStatsMap[tcpConnectionState(st)]
if !flag {
info = make(map[string]float64, 0)
info[ipv4] = 1
} else {
info[ipv4]++
Expand Down

0 comments on commit 7f66ffa

Please sign in to comment.