Commit Graph

2727 Commits

Author SHA1 Message Date
Matt Joiner a01b451857 Add ClientConfig.AcceptPeerConnections 2021-06-21 12:14:01 +10:00
Matt Joiner af1ca91e04 Remove conntrack, expose Torrent.AnnounceToDht, ClientConfig.PeriodicallyAnnounceTorrentsToDht 2021-06-21 12:13:53 +10:00
Matt Joiner ebd19af795 Merge branch 'request-strategy-rewrite' 2021-06-21 12:04:06 +10:00
Zilog8 e2a559e243
Allow Storage Backends to do their own Hashing (#518)
* Allow Storage Backends to do their own Hashing

- Describes an optional interface 'SelfHashing' that a storage backend's type implementing 'PieceImpl' may also implement in order to calculate piece hashsums itself.

- Alters the 'hashPiece' function in the torrent package to look for types implementing 'SelfHashing' . If not implemented, calculate the hash as usual.
2021-06-08 15:45:35 +10:00
deepsource-autofix[bot] a68f040ea6 Fix nil context being passed to function 2021-06-07 19:32:02 +10:00
Matt Joiner f183acefe2 Add default param name in TorrentImpl.Piece func 2021-06-07 13:01:40 +10:00
Matt Joiner ef39f408fe Add storage/disabled
The default storage will create empty files on torrent open, which is undesirable in some circumstances. This storage implementation is explicit about not storing anything.
2021-06-07 13:01:40 +10:00
Matt Joiner bc186ac211 Expose AnacrolixDhtServerWrapper 2021-06-07 13:01:40 +10:00
Matt Joiner 7d9e2b18d6 Extract chansync to github.com/anacrolix/chansync 2021-06-07 13:01:40 +10:00
Matt Joiner 047cdbae0d bencode: Improve support for embedded structs 2021-06-07 13:01:40 +10:00
Matt Joiner 25d2eea12d bencode: Support anonymous embedded struct pointers
More to come if this line of improvement is retained.
2021-06-07 13:01:40 +10:00
Matt Joiner 259356ccd6 Rework bencode decoding so it might support embedded structs 2021-06-07 13:01:40 +10:00
Matt Joiner f50b8fc2fa Fix issue with duplicate preallocated requests
Likely introduced by allowing actual and next request states to differ.
2021-06-07 13:01:40 +10:00
Matt Joiner e0a4831f27 Fix bitmap-related benchmark 2021-06-07 13:01:40 +10:00
Matt Joiner c895a21a16 Track chunks read for webseed peers too 2021-06-07 13:01:40 +10:00
Matt Joiner 33d3a75cd3 Rename file 2021-06-07 13:01:40 +10:00
Matt Joiner 906db030f3 Add peerConnMsgWriter file
Forgot this earlier, new to Sublime Merge.
2021-06-07 13:01:40 +10:00
Matt Joiner a2dbec3b4a Add chansync interfaces 2021-06-07 13:01:40 +10:00
Matt Joiner 47c49735fc Fix race in piece availability runs 2021-06-07 13:01:40 +10:00
Matt Joiner 36f52d7a14 Apply next request state asynchronously 2021-06-07 13:01:40 +10:00
Matt Joiner d37dea1f61 Move peerConnMsgWriter into its own file 2021-06-07 13:01:40 +10:00
Matt Joiner 24ceed61da Break out peerConnWriter 2021-06-07 13:01:40 +10:00
Matt Joiner 925f5d147d Resolve local replaces 2021-06-07 13:01:40 +10:00
Matt Joiner b43987fcc8 Fix up some crashes around piece availability 2021-06-07 13:01:40 +10:00
Matt Joiner 1a27e14391 Don't always force piece reallocation
The balancing for unforced pieces may not be exactly what we want yet.
2021-06-07 13:01:39 +10:00
Matt Joiner 95d808d3c5 Use rejiggered missinggo bitmap 2021-06-07 13:01:39 +10:00
Matt Joiner a26e7f9933 Determine peer max requests based on receive speed 2021-06-07 13:01:39 +10:00
Matt Joiner 86524214f5 Merge maxRequests into localClientReqq 2021-06-07 13:01:39 +10:00
Matt Joiner 42bf6b58a6 Fix in decPieceAvailability when we don't have torrent info
Happens when we close a Peer before getting Torrent info.
2021-06-07 13:01:39 +10:00
Matt Joiner fcc4ef2b95 Fix sqlite piece completion 2021-06-07 13:01:39 +10:00
Matt Joiner ad298364aa Add client-level max unverified bytes 2021-06-07 13:01:39 +10:00
Matt Joiner 63b0e42731 Get max unverified bytes working 2021-06-07 13:01:39 +10:00
Matt Joiner 307d6d178f Prepare to implement max unverified bytes 2021-06-07 13:01:39 +10:00
Matt Joiner 8e9cb9f2be Do checks for preallocated requests too
Otherwise we reserve requests with the assumption that they can be assigned later, and they actually might not be.
2021-06-07 13:01:39 +10:00
Matt Joiner 9dd85e5bd2 Fix non-deterministic test 2021-06-07 13:01:39 +10:00
Matt Joiner b80e2b08b5 Get request rebalancing working optimally! 2021-06-07 13:01:39 +10:00
Matt Joiner 4e9f707aeb Move piece allocation to its own func 2021-06-07 13:01:39 +10:00
Matt Joiner 07ba6e9210 New tests and fixes for them
Not complete. There's still a request-stealing balancing issue, but it's functional for now.
2021-06-07 13:01:39 +10:00
Matt Joiner e7c5ed679f Don't log each applied request 2021-06-07 13:01:39 +10:00
Matt Joiner 26837ee73c Add a working request strategy test 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 233135493f Improve num requests per piece status output 2021-06-07 13:01:39 +10:00
Matt Joiner f19564d597 Improve piece availability status output 2021-06-07 13:01:39 +10:00
Matt Joiner ef489f4a44 Fixes to reassigning chunks in requests 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 4577e8a3c1 Forgot to remove initial have all state for webseeds
Later when the webseed was closed, it was assumed that it had contributed to the piece availability count.
2021-06-07 13:01:39 +10:00
Matt Joiner 16eb8a9693 Do requests every 100ms 2021-06-07 13:01:39 +10:00
Matt Joiner a2fcce5374 Don't need stable sort 2021-06-07 13:01:39 +10:00
Matt Joiner fc06909014 Improve naming on storage key 2021-06-07 13:01:39 +10:00
Matt Joiner 875ead3582 Reuse pieceRequestOrder slice 2021-06-07 13:01:39 +10:00