Skip to content

Commit

Permalink
Merge pull request #388 from askuy/feature/optimizecontextcancel
Browse files Browse the repository at this point in the history
tcp stat ipv4
  • Loading branch information
askuy authored Jun 6, 2024
2 parents b5b910f + 7f66ffa commit 24efa37
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 24efa37

Please sign in to comment.