Matt Joiner
364d3dd208
Rewrite file.bytesLeft
...
Avoids iteration, and should handle files that are entirely inside a single piece, as well as zero-sized at the beginning of a torrent. Should fix #387 .
2020-03-24 12:15:35 +11:00
Matt Joiner
4be8b12207
Rename variables in fileBytesLeft
2020-03-24 11:21:42 +11:00
Matt Joiner
3507ff1a69
Add abstraction and tests for #387
2020-03-24 11:19:11 +11:00
Matt Joiner
4c989da21e
Extract the request strategy logic
...
Bit messy. Now it'll be easier to clean-up what it depends on, and test.
2020-01-14 10:51:09 +11:00
i96751414
f15aa27e24
Fix bytesLeft for files ( #348 )
...
* Refactor (*File).bytesLeft
* Always use the same piece size
2019-11-30 19:53:35 +11:00
Matt Joiner
d26b93cff4
Add comments on File.{first,end}PieceIndex
2019-11-28 12:51:25 +11:00
Matt Joiner
e08da0e6e0
Change File.endPieceIndex calculation
...
I think previously it would round-up when it shouldn't.
2019-11-28 12:51:25 +11:00
i96751414
f22acca804
Add BytesCompleted method for files ( #347 )
...
* Add BytesCompleted method for files
* Make sure we check limit pieces correctly
* Remove unnecessary info check
2019-11-26 11:54:26 +11:00
Matt Joiner
3ba991e38a
Remove unused code
2018-11-27 23:57:17 +11:00
Matt Joiner
6dd3b9c12c
Law of Demeter Client.mu
2018-07-25 13:42:28 +10:00
Matt Joiner
6d6197b0a1
Switch pieceIndex back to an int
...
I suspect that interface conversions using packet iter are causing a lot of allocation. Either way, with the casting this adds, we should be able to change pieceIndex's type alias now with minimal code change.
2018-07-17 21:28:01 +10:00
Matt Joiner
f5bd377941
Change pieceIndex to peer_protocol.Integer
2018-07-12 09:15:15 +10:00
Matt Joiner
21108bf6ec
Fix file piece index offset calculations
2018-01-25 17:01:29 +11:00
Matt Joiner
29aa07f1a9
Don't lock Client in File.DisplayPath
2018-01-25 16:58:49 +11:00
Matt Joiner
0b553b296f
Add File priorities
...
Fixes #220 .
2018-01-21 22:49:12 +11:00
Matt Joiner
7f48246119
Improve various File related doc comments
2018-01-07 11:57:02 +11:00
Matt Joiner
87a033e074
Readers obtained from File.NewReader should not readahead into other Files
...
Fixes #221 . Additionally Torrent.length is a pointer and isn't set until the info is available to avoid it defaulting to zero.
2018-01-06 23:15:41 +11:00
Matt Joiner
4d1451f979
Rename File.PrioritizeRegion to DownloadRegion
...
Fixes #223
2018-01-06 16:54:17 +11:00
Matt Joiner
9b718566ba
Add File.NewReader
...
Fixes #222
2018-01-06 16:37:13 +11:00
Matt Joiner
43a573d46f
Move File.State lock to top of function
2017-05-26 13:00:28 +10:00
Matt Joiner
93f914a6d3
Fix receiver pointeriness for some File methods
2016-04-19 17:20:31 +10:00
Seth Hoenig
9f4bf70e17
refactor struct identifiers to follow conventional go names
2016-04-18 23:11:11 -05:00
Matt Joiner
d3a1c79c79
Merge Torrent and torrent types
2016-04-03 18:40:43 +10:00
Matt Joiner
125c864a8c
Add some File method comments
2016-03-19 17:40:30 +11:00
Matt Joiner
7ac5dfd828
Reinstate File.PrioritizeRegion() for backward compatibility
2016-02-07 17:15:06 +11:00
Matt Joiner
63c73e18b3
Add File.Cancel
2016-02-05 01:18:54 +11:00
Matt Joiner
2f40c48d37
Fix the download/prioritize piece functions
...
This involves adding a pendingPieces field to torrent.
2016-01-19 01:28:56 +11:00
Matt Joiner
89a6a20af6
Finally make Torrent.torrent private
...
A lot of code was using unintentionally exported stuff from the embedded *torrent in Torrent.
2016-01-17 00:14:15 +11:00
Matt Joiner
153c13db43
Revert "Merge pull request #54 from zhulik/master"
...
This reverts commit 5cf75b869c
, reversing
changes made to 09050ff2c5
.
2016-01-06 12:19:49 +11:00
Gleb Sinyavsky
48c3df2d43
Refactorings
2016-01-05 11:48:16 +03:00
Gleb Sinyavsky
5b790bf874
Torrent structs replaced with Download interface in exported Client methods
2015-12-27 14:49:15 +03:00
Matt Joiner
55cae072f5
Add method File.Torrent
2015-11-12 03:25:04 +11:00
Matt Joiner
6d7dd06b47
Add comment doc for File.PrioritizeRegion
2015-11-09 22:27:38 +11:00
Matt Joiner
87433b00ba
Add File.DisplayPath
...
It's used in many places, I just never formalized it. This will help prevent bugs and misuse of File.Path
2015-08-04 00:45:15 +10:00
Matt Joiner
35fa1e3365
Avoid holding client lock while scanning pieces in File.State
...
Some torrent data backends are expensive to query.
2015-07-17 20:58:25 +10:00
Matt Joiner
71f5a1882a
Fix a few data races
2015-06-03 00:00:25 +10:00
Matt Joiner
21fb4933fc
Change the way piece state is exposed to give more detail
2015-06-01 18:22:12 +10:00
Matt Joiner
526d9d738e
Rewrite imports to local bencode and metainfo
2015-04-27 14:55:01 +10:00
Matt Joiner
28b299e7c8
Rework the Torrent Reader interface, to allow reader options, and add "responsive" as one such option
...
Had several weeks of testing. Removes a lot of the "helper" reading methods, but this was necessary to allow per-Torrent reading options.
2015-04-14 23:59:41 +10:00