Reinstate File.PrioritizeRegion() for backward compatibility

This commit is contained in:
Matt Joiner 2016-02-07 17:15:06 +11:00
parent 77d6e9e5cb
commit 7ac5dfd828
1 changed files with 4 additions and 0 deletions

View File

@ -79,6 +79,10 @@ func (f *File) Download() {
f.t.DownloadPieces(f.t.torrent.byteRegionPieces(f.offset, f.length)) f.t.DownloadPieces(f.t.torrent.byteRegionPieces(f.offset, f.length))
} }
func (f *File) PrioritizeRegion(off, len int64) {
f.t.DownloadPieces(f.t.torrent.byteRegionPieces(f.offset+off, len))
}
func byteRegionExclusivePieces(off, size, pieceSize int64) (begin, end int) { func byteRegionExclusivePieces(off, size, pieceSize int64) (begin, end int) {
begin = int((off + pieceSize - 1) / pieceSize) begin = int((off + pieceSize - 1) / pieceSize)
end = int((off + size) / pieceSize) end = int((off + size) / pieceSize)