Inlineable `(*File).BytesCompleted()` (#612)
This commit is contained in:
parent
be8b7b7d35
commit
57b4e78b0f
9
file.go
9
file.go
|
@ -44,13 +44,14 @@ func (f *File) Length() int64 {
|
||||||
|
|
||||||
// Number of bytes of the entire file we have completed. This is the sum of
|
// Number of bytes of the entire file we have completed. This is the sum of
|
||||||
// completed pieces, and dirtied chunks of incomplete pieces.
|
// completed pieces, and dirtied chunks of incomplete pieces.
|
||||||
func (f *File) BytesCompleted() int64 {
|
func (f *File) BytesCompleted() (n int64) {
|
||||||
f.t.cl.rLock()
|
f.t.cl.rLock()
|
||||||
defer f.t.cl.rUnlock()
|
n = f.bytesCompletedLocked()
|
||||||
return f.bytesCompleted()
|
f.t.cl.rUnlock()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *File) bytesCompleted() int64 {
|
func (f *File) bytesCompletedLocked() int64 {
|
||||||
return f.length - f.bytesLeft()
|
return f.length - f.bytesLeft()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue