Add 0 guard

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-09-08 12:19:37 +02:00
parent 4fce0181ab
commit b66058e417
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -158,6 +158,9 @@ func (bpt *bsPeerTracker) logSuccess(p peer.ID, dur time.Duration, reqSize uint6
}
pi.successes++
if reqSize == 0 {
reqSize = 1
}
logTime(pi, dur/time.Duration(reqSize))
}
@ -173,6 +176,9 @@ func (bpt *bsPeerTracker) logFailure(p peer.ID, dur time.Duration, reqSize uint6
}
pi.failures++
if reqSize == 0 {
reqSize = 1
}
logTime(pi, dur/time.Duration(reqSize))
}