Commit Graph

56 Commits

Author SHA1 Message Date
Matt Joiner 8c9a308c9a Only steal an odd request if the stealer more recently received a chunk
This helps break the stealing cycle during endgame, and lets us trickle the request to the peer conn with the best record. It might not be sufficient but works nice in testing so far.
2021-12-12 18:35:01 +11:00
Matt Joiner 7de7b986c9 Only use last requested when both requests are already pending 2021-12-12 18:35:01 +11:00
Matt Joiner ddf41fc2f1 Add Torrent-level request cancel for consistency 2021-12-12 18:35:01 +11:00
Matt Joiner 117ae28b38 Try request stealing 2021-12-12 18:35:01 +11:00
Matt Joiner 73be571f50 Don't try to request anything without the torrent info 2021-12-12 18:35:01 +11:00
Matt Joiner 99a64bcf63 Wait between duplicate requests 2021-12-12 18:35:01 +11:00
Matt Joiner 135f21fb64 Use interfaces to lazily expose the bare minimum inputs to GetRequestablePieces 2021-12-12 18:35:01 +11:00
Matt Joiner 4088e847f3 Provide mapping from infohash to Torrent in Input 2021-12-12 18:35:01 +11:00
Matt Joiner 94bb5d40ba Implement piece request ordering with retained state 2021-12-12 18:35:01 +11:00
Matt Joiner 67ed5d0032 Partition piece request strategy by storage capacity key 2021-12-12 16:56:01 +11:00
Matt Joiner 4cfdc2f497 Shuffle duplicate requests
Add missing import
2021-12-12 16:56:00 +11:00
Matt Joiner a9485e8796 Ensure peerRequests.torrentStrategyInput is set 2021-12-12 15:01:50 +11:00
Matt Joiner 8e707c9b15 Remove unused peer stuff in request strategy 2021-11-29 10:14:16 +11:00
Matt Joiner 1071e261e1 Remove unused Client.updateRequests 2021-11-12 13:55:43 +11:00
Matt Joiner c6ee03f449 gofumpt 2021-11-08 14:47:01 +11:00
Matt Joiner a7e7cbcb04 Retain the desired request ordering
This means we don't have to randomize the request order when we finally apply it to avoid favouring lower indices. The difference is very subtle but should be impactful with smaller connection counts and rarer torrents.
2021-10-27 10:13:39 +11:00
Matt Joiner 31985f1ea0 Add Peer.mustRequest 2021-10-26 15:03:04 +11:00
Matt Joiner 344ada8b7c Add disabled code for limiting wasted chunks 2021-10-25 21:37:25 +11:00
Matt Joiner ccf57798a2 Fix iter pending chunk request offsets 2021-10-25 20:53:39 +11:00
Matt Joiner e8067f741f Always count unhandled requests as pending
Fixes https://github.com/anacrolix/torrent/issues/679.
2021-10-25 16:36:58 +11:00
Matt Joiner 37373864e4 Add more comprehensive pending requests assertions 2021-10-25 16:16:56 +11:00
Matt Joiner e884b8079b Fix panic when sustaining unrejected requests after being choked
Fixes https://github.com/anacrolix/torrent/issues/680.
2021-10-25 13:00:56 +11:00
Matt Joiner 8eec0b665e Update webseeds for peer requesting 2021-10-21 10:28:57 +11:00
Matt Joiner b50e941d1d Refresh updates after 3s instead of 1s 2021-10-19 14:08:56 +11:00
Matt Joiner 4ce06bef00 Randomize request order 2021-10-19 14:08:56 +11:00
Matt Joiner ccce2dba13 Improvements to request refreshing 2021-10-19 14:08:56 +11:00
Matt Joiner 1201ccc53b Refresh requests after a second of no updates 2021-10-19 14:08:56 +11:00
Matt Joiner e8e7ef989b Fix log message argument 2021-10-19 14:08:56 +11:00
Matt Joiner de87fd3eb1 Avoid allocation putting undirtiedChunksIter into interface 2021-10-19 14:08:56 +11:00
Matt Joiner 23b4e2dc9c Wait for cancelled requests to be rejected per the spec 2021-10-19 14:08:56 +11:00
Matt Joiner 8b90e737c8 Panic if pending request count goes negative in requesting 2021-10-19 14:08:56 +11:00
Matt Joiner 464e1297b0 Use pointer receiver for peerRequests.{Less,Len} 2021-10-19 14:08:56 +11:00
Matt Joiner 0a8e66c7fc Simplify request ordering for reversed conditions 2021-10-19 14:08:56 +11:00
Matt Joiner 7f236506cb Don't automatically delete requests if we're choked with fast extension 2021-10-19 14:08:56 +11:00
Matt Joiner 610f8e0185 Don't put requests we can't make into the request heap
In particular this should save a lot of overhead if we're choked.
2021-10-19 14:08:56 +11:00
Matt Joiner 7d0be0ac65 Optimize chunk calculations in request strategy 2021-10-19 14:08:56 +11:00
Matt Joiner 9aff9f3592 Extract pendingRequests 2021-10-19 14:08:56 +11:00
Matt Joiner 16c571b58b Add pprof labels for request updates and remove Client-wide requester 2021-10-19 14:08:13 +11:00
Matt Joiner 30b99e7102 Remove peer piece inclination and piece request order
These are vestigial data structures used with old request strategy implementations.
2021-10-19 14:08:13 +11:00
Matt Joiner 0f53cbf07e Change peer requesting to spread requests out evenly 2021-10-19 14:08:13 +11:00
Matt Joiner 9720fd576d Update chansync 2021-10-07 11:45:09 +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 a330b23e9e Default to peer requesting disabled
There are some flaws that need to be fixed up before it might be considered the default.
2021-09-21 16:07:08 +10:00
Matt Joiner 110b6f3fd3 Fix cancellation for global requesting 2021-09-20 15:24:24 +10:00
Matt Joiner 510877ea43 Reduce the diff to master and add peerRequesting feature const 2021-09-20 15:09:28 +10:00
Matt Joiner 1d2d1a9cde Store peer requests in a bitmap 2021-09-19 15:16:37 +10:00
Matt Joiner 21358ba458 Do peer requests separately for each peer 2021-09-18 20:34:14 +10:00
Matt Joiner cfb23e271f Export request_strategy.GetRequestablePieces 2021-09-18 18:57:50 +10:00
Matt Joiner aa32c94844 Rejig waits between doRequests 2021-09-16 00:12:58 +10:00
Matt Joiner 72b0fee1eb Simplify PIece.iterUndirtiedChunks 2021-09-15 23:33:17 +10:00