2
0
mirror of synced 2025-02-24 14:48:27 +00:00

62 Commits

Author SHA1 Message Date
Matt Joiner
27108bd2f7 Export Peer 2021-01-25 15:49:48 +11:00
Matt Joiner
99ddad31c9 Track piece marking state separately 2020-11-21 13:44:23 +11:00
Matt Joiner
e6da640bb2 Tidy up doc, file names, naming 2020-11-09 10:56:45 +11:00
Matt Joiner
dcb2c0bb41 Fix piece getting queued for hash multiple times
Pieces could get queued for hash multiple times when we receive chunks if the piece starts getting hashed before we're done writing all the chunks out. This was only found because piece hashing currently only checks the incomplete data, which is missing after the first piece hash passes, the data is marked complete, then the subsequently queued hash has nothing to read.
2020-11-06 08:39:56 +11:00
Matt Joiner
808fd4b382 Optimize padding on Piece 2020-09-29 16:37:58 +10:00
Matt Joiner
de88c620bc Seperate peer and PeerConn 2020-05-30 15:18:28 +10:00
Craig Campbell
6920298770 Add Piece.UpdateCompletion() method
This should be all that is needed to handle pieces that are evicted or
removed from storage if you are using a storage implementation such as an LRU
cache.
2020-04-05 08:57:58 +10:00
Matt Joiner
75e55a3e99 Add Piece.State 2020-02-27 16:41:33 +11:00
Matt Joiner
dff436f102 Rename connection->PeerConn and fix exports 2020-02-21 11:07:50 +11:00
Matt Joiner
376ff763fe Apply staticcheck 2020-02-20 11:09:57 +11:00
Matt Joiner
53e334d3f2 Move all the request strategy stuff into its file 2020-01-24 17:55:20 +11:00
Matt Joiner
48eb7ff3f2 Expose request strategies 2020-01-24 17:30:57 +11:00
Matt Joiner
2559af0f9c Extract the request timeout stuff into requestStrategyThree 2020-01-14 10:51:09 +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
Matt Joiner
1039e00955 When piece checks fail only ban untrusted peers and only when the entire piece is dirty
This should help with addressing https://github.com/anacrolix/torrent/issues/364.
2020-01-14 10:51:09 +11:00
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