Skip to content

Commit

Permalink
Fix bug if traffic retuans scientific notation val
Browse files Browse the repository at this point in the history
  • Loading branch information
madao authored and madao committed Sep 23, 2019
1 parent 9e62d02 commit 8b360a8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,22 @@ func getTraffic(c chan traffic) {
return
}
receiveAndSend := strings.Split(string(b[:len(b)-1]), " ")
receive, err := strconv.ParseUint(receiveAndSend[0], 10, 64)
receive, err := strconv.ParseFloat(receiveAndSend[0], 10)
if err != nil {
logger.Logger.Warn("Get receive from string failed. Return nil struct traffic.",
zap.Error(err))
c <- *new(traffic)
return
}
send, err := strconv.ParseUint(receiveAndSend[1], 10, 64)
send, err := strconv.ParseFloat(receiveAndSend[1], 10)
if err != nil {
logger.Logger.Warn("Get send from string failed. Return nil struct traffic.",
zap.Error(err))
c <- *new(traffic)
return
}
var ret traffic
ret.receive, ret.send, ret.t = receive, send, time
ret.receive, ret.send, ret.t = uint64(receive), uint64(send), time
c <- ret
}
}
Expand Down

0 comments on commit 8b360a8

Please sign in to comment.