2
0
mirror of synced 2025-02-23 14:18:13 +00:00

Inlineable (*Torrent).PieceState() (#621)

This commit is contained in:
YenForYang 2021-09-14 19:14:28 -05:00 committed by GitHub
parent d00ba917c0
commit 542970b961
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

7
t.go
View File

@ -74,10 +74,11 @@ func (t *Torrent) PieceStateRuns() (runs PieceStateRuns) {
return
}
func (t *Torrent) PieceState(piece pieceIndex) PieceState {
func (t *Torrent) PieceState(piece pieceIndex) (ps PieceState) {
t.cl.rLock()
defer t.cl.rUnlock()
return t.pieceState(piece)
ps = t.pieceState(piece)
t.cl.rUnlock()
return
}
// The number of pieces in the torrent. This requires that the info has been