2
0
mirror of synced 2025-02-23 22:28:11 +00:00

47 Commits

Author SHA1 Message Date
Matt Joiner
77b74dd39d Re-order the logic in Piece.VerifyData for better logging 2019-07-25 14:15:36 +10:00
Matt Joiner
e9b10f774d Comments on the VerifyData methods 2019-07-25 14:13:42 +10:00
Matt Joiner
b102ce901a Reduce allocations for Piece.hash 2019-01-30 17:54:02 +11:00
Matt Joiner
fc4fab91f5 Switch to goimports import sorting
Used to use sortimports, but it's old, and goimports seems to have an opinion now.
2018-11-02 23:12:01 +11:00
Matt Joiner
6dd3b9c12c Law of Demeter Client.mu 2018-07-25 13:42:28 +10:00
Matt Joiner
f5bd377941 Change pieceIndex to peer_protocol.Integer 2018-07-12 09:15:15 +10:00
Matt Joiner
c921242f30 Do requests synchronously, and don't request from hashing or queued pieces
Calculating the desired state was a nice idea, but too hard to debug. This way should also be faster.
2018-06-26 14:51:55 +10:00
Matt Joiner
898e878c69 Aggressively wake Readers 2018-02-04 22:47:01 +11:00
Matt Joiner
e67b85215c Piece.everHashed is replaced by storageCompletionOk 2018-02-03 12:14:39 +11:00
Matt Joiner
f23d097502 Include closed connections in dirtiers 2018-02-03 12:08:16 +11:00
Matt Joiner
906d3bc5bb Include completion known in PieceState 2018-01-28 15:58:55 +11:00
Matt Joiner
52524925d2 Add separate piece priorities, and cache pending pieces
Should fix a bug where prioritizing files is not alone sufficient to trigger downloading.
2018-01-25 17:18:36 +11:00
Matt Joiner
4807d05018 Improve some comments 2018-01-25 17:02:52 +11:00
Matt Joiner
0b553b296f Add File priorities
Fixes #220.
2018-01-21 22:49:12 +11:00
Matt Joiner
ed7e3f6ec0 Make Torrent.pendingPieces a priority bitmap in preparation for #220 2018-01-12 12:24:37 +11:00
Matt Joiner
be3f32e962 Fix a lot of noisy logging and test warnings 2017-11-07 16:00:08 +11:00
Matt Joiner
dd083a4e11 Track completion known to implementation state
Addresses #193
2017-10-12 16:09:32 +11:00
Matt Joiner
17ea4f7fdd Performance optimizations to calculating bytes left in Torrent
Was generating significant overhead in cmd/torrent
2017-09-23 15:28:13 +10:00
Matt Joiner
b3137b1ede Make type piece public 2017-09-15 19:35:16 +10:00
Matt Joiner
2aa20b3e22 Don't verify data at startup, add Torrent.Piece.VerifyData and Torrent.VerifyData for this purpose
This has the side effect of deflaking a lot of tests that race to verify data when a torrent is added.
2017-09-15 19:22:32 +10:00
Matt Joiner
945d982877 Comment on PiecePriorityNext 2016-08-30 16:55:50 +10:00
Matt Joiner
6c15a030d6 Improve comments 2016-08-30 15:07:59 +10:00
Seth Hoenig
9f4bf70e17 refactor struct identifiers to follow conventional go names 2016-04-18 23:11:11 -05:00
Matt Joiner
b80bb6393a Use metainfo.Hash for piece and info hashes 2016-04-04 13:01:31 +10:00
Matt Joiner
d3a1c79c79 Merge Torrent and torrent types 2016-04-03 18:40:43 +10:00
Matt Joiner
08830b97a1 Make everything on type torrent private 2016-04-03 16:50:53 +10:00
Matt Joiner
b97b50aca9 New storage interface 2016-03-28 20:38:30 +11:00
Matt Joiner
bb04cb8843 Tidy up bytesLeft calculations
This should fix a bug where completion is shown as negative in WriteStatus
2016-03-22 13:11:36 +11:00
Matt Joiner
623d9e0e06 Rework requesting of shuffled pending pieces 2016-02-07 21:58:48 +11:00
Matt Joiner
1b8bc1498c Use missinggo.bitmap for tracking dirty chunks 2016-02-05 15:45:32 +11:00
Matt Joiner
63c73e18b3 Add File.Cancel 2016-02-05 01:18:54 +11:00
Matt Joiner
430f26f726 Recalculate all piece priorities more efficiently 2016-02-01 22:06:13 +11:00
Matt Joiner
afa264e6c5 Reintroduce connection piece inclinations, and begin caching piece priorities 2016-02-01 21:11:41 +11:00
Matt Joiner
ae9bba2611 Fix downloading of unwanted chunks, and write out downloaded chunks using the connection loop goroutine
Doing the writes with the connection loop goroutine prevents memory use blowing out when chunks aren't written out quickly enough.
2016-01-28 05:54:48 +11:00
Matt Joiner
90348f6a48 Add pending write helpers 2016-01-25 07:22:33 +11:00
Matt Joiner
06445f2a1e It's working and the tests are usually passing
I still need to handle "prefetch"-style downloading, and some functions haven't been committed to force this issue.
2016-01-18 18:35:14 +11:00
Matt Joiner
2beb5f8bd4 Track dirty chunks, instead of pending chunk specs
This is the first step toward having purely Reader-based priorities. If a chunk is pending, that currently implies that we want to download it. I want to move that kind of state out to the readers.
2016-01-13 17:11:59 +11:00
Matt Joiner
d01c6221e6 Remove sync.Cond from piece
It's not trivial to ensure that anyone waiting on the piece Cond will wake on events like the torrent being dropped from the client.
2015-11-06 00:40:16 +11:00
Matt Joiner
eebd09c0fe Allow subscribing to torrent piece state changes 2015-09-06 12:33:22 +10:00
Matt Joiner
085be622a0 Replacing pendingWrites WaitGroup with Mutex/Cond/int
Apparently I've been using WaitGroups wrong all along.
2015-08-05 02:40:46 +10:00
Matt Joiner
7e9fe4f447 Store chunk data without holding client lock 2015-07-15 16:00:59 +10:00
Matt Joiner
c018c660f0 Allow chunk size to be specified per torrent 2015-07-15 15:31:18 +10:00
Matt Joiner
ced5733c88 Improve uploading/seeding 2015-06-16 16:57:47 +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
bc4aa06c91 Comments 2015-06-01 18:17:14 +10:00
Matt Joiner
1cf591dc3d Switch to using a slice for tracking pending chunks. Saves massive amounts of memory. 2015-05-16 10:51:48 +10:00
Matt Joiner
6c48d59adb Move piece into its own file 2015-04-08 02:14:35 +10:00