Commit Graph

87 Commits

Author SHA1 Message Date
Matt Joiner 3e0f34934d
gorond ./... 2022-11-15 23:31:27 +11:00
Alex Sharov 75cc4e98d4
Do torrent storage flush on piece completion (#755) 2022-07-07 15:46:27 +10:00
Matt Joiner 39bd8fc5a0
Use reusable roaring iterators 2022-05-12 10:42:16 +10:00
Matt Joiner daff06cf20
Move undirtiedChunksIter into its own file 2022-05-09 12:51:01 +10:00
Matt Joiner 9a9c7dee00
Add and use typed roaring bitmap 2022-05-09 12:05:50 +10:00
Matt Joiner c54dc22592 Benchmark PieceRequestOrder with varying styles of path hint usage
Add per-piece piece request order path hints
2022-01-22 18:39:36 +11:00
Matt Joiner 506ff8d037 Use relative availabilities to determine piece request order
Most overhead comes from peers that connect that have everything, and we just increment every single piece's availability. There may be some unresolved determinism with torrents that share the same ordering.
2021-12-23 14:00:00 +11:00
Matt Joiner 94bb5d40ba Implement piece request ordering with retained state 2021-12-12 18:35:01 +11:00
Matt Joiner c6ee03f449 gofumpt 2021-11-08 14:47:01 +11:00
Matt Joiner de87fd3eb1 Avoid allocation putting undirtiedChunksIter into interface 2021-10-19 14:08:56 +11:00
Matt Joiner 2be5a95b06 Add reasons for updateRequests to be triggered 2021-10-19 14:08:56 +11:00
Matt Joiner 329578520a Pieces being marked should have priority none
Also reorder the checks a bit to favour the cheaper ones.
2021-10-19 14:00:52 +11:00
Matt Joiner eab111dd84 Switch Peer.PieceAllowedFast and several request strategy inputs to raw roaring.Bitmaps
This is in preparation to support encoding request strategy run inputs for benchmarking.
2021-10-05 20:06:23 +11:00
Matt Joiner ad70a761ec Use an iterator to skip through dirty chunks 2021-09-21 10:48:15 +10:00
Matt Joiner 63b3d2d211 Track dirty chunks in a single bitmap on Torrent 2021-09-20 18:52:54 +10:00
Matt Joiner 1d2d1a9cde Store peer requests in a bitmap 2021-09-19 15:16:37 +10:00
Matt Joiner 72b0fee1eb Simplify PIece.iterUndirtiedChunks 2021-09-15 23:33:17 +10:00
Matt Joiner 175b826e73 Rework Reader waiting 2021-09-04 23:07:32 +10:00
Matt Joiner 72c74f7800 Remove unused code 2021-08-19 16:06:46 +10:00
Matt Joiner 95d808d3c5 Use rejiggered missinggo bitmap 2021-06-07 13:01:39 +10:00
Matt Joiner 0d4e566fc0 Extract request strategy stuff into a separate module 2021-06-07 13:01:39 +10:00
Matt Joiner 09823b9e36 Rework to improve work stealing and try to thread peers through all request pieces 2021-06-07 13:01:39 +10:00
Matt Joiner b508877d82 Track peer availability at the Torrent-level 2021-06-07 13:01:39 +10:00
Matt Joiner 0830589b0a Pass tests with new full-client request strategy implementation 2021-06-07 13:01:39 +10:00
Matt Joiner 456a2f7c5d Expose more callbacks and Request and ChunkSpec 2021-01-28 14:23:22 +11:00
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