Inlineable methods to access File piecePriority (#601)
This commit is contained in:
parent
5c440e8929
commit
52e8c82999
16
file.go
16
file.go
|
@ -146,19 +146,19 @@ func (f *File) NewReader() Reader {
|
|||
// Sets the minimum priority for pieces in the File.
|
||||
func (f *File) SetPriority(prio piecePriority) {
|
||||
f.t.cl.lock()
|
||||
defer f.t.cl.unlock()
|
||||
if prio == f.prio {
|
||||
return
|
||||
if prio != f.prio {
|
||||
f.prio = prio
|
||||
f.t.updatePiecePriorities(f.firstPieceIndex(), f.endPieceIndex())
|
||||
}
|
||||
f.prio = prio
|
||||
f.t.updatePiecePriorities(f.firstPieceIndex(), f.endPieceIndex())
|
||||
f.t.cl.unlock()
|
||||
}
|
||||
|
||||
// Returns the priority per File.SetPriority.
|
||||
func (f *File) Priority() piecePriority {
|
||||
func (f *File) Priority() (prio piecePriority) {
|
||||
f.t.cl.lock()
|
||||
defer f.t.cl.unlock()
|
||||
return f.prio
|
||||
prio = f.prio
|
||||
f.t.cl.unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// Returns the index of the first piece containing data for the file.
|
||||
|
|
Loading…
Reference in New Issue