Implement a public `Peer.DownloadRate` (#750)
This commit is contained in:
parent
eeb021b134
commit
ed1fe91dd2
|
@ -351,6 +351,13 @@ func (cn *Peer) downloadRate() float64 {
|
|||
return float64(num) / cn.totalExpectingTime().Seconds()
|
||||
}
|
||||
|
||||
func (cn *Peer) DownloadRate() float64 {
|
||||
cn.locker().Lock()
|
||||
defer cn.locker().Unlock()
|
||||
|
||||
return cn.downloadRate()
|
||||
}
|
||||
|
||||
func (cn *Peer) iterContiguousPieceRequests(f func(piece pieceIndex, count int)) {
|
||||
var last Option[pieceIndex]
|
||||
var count int
|
||||
|
|
Loading…
Reference in New Issue