skip add for zero
This commit is contained in:
parent
470eeb921c
commit
fd035148bb
1 changed files with 3 additions and 1 deletions
|
|
@ -84,7 +84,9 @@ func (r *Rate) SetReader(reader io.Reader) {
|
|||
|
||||
func (r *Rate) Read(b []byte) (n int, err error) {
|
||||
n, err = r.r.Read(b)
|
||||
atomic.AddInt64(&r.num, int64(n))
|
||||
if n > 0 {
|
||||
atomic.AddInt64(&r.num, int64(n))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue