Commit Graph

64 Commits

Author SHA1 Message Date
Matt Joiner fc857d4557 Allow stealing from slower connections within priority classes 2021-12-24 08:56:10 +11:00
Matt Joiner 1bae62fd22 Dynamic outbound max requests
This might be one solution to https://github.com/anacrolix/torrent/issues/698.
2021-12-24 08:55:57 +11:00
Matt Joiner 89b8b78980 Include requests pending cancel in current request count
This fix a situation where peers might be dropping our requests, and since we depend on all requests being satisfied before re-requesting, we get stuck waiting for the request to be filled.
2021-12-23 18:55:57 +11:00
Matt Joiner 9739afce93 Fix panic in webseeds updating requests when Torrent is closed
I think this was caused by PieceRequestOrder being removed if all pieces in a storage capacity key are deleted.
2021-12-23 14:00:01 +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 c0a888ee17 Tidy up request heaping comments 2021-12-13 12:12:30 +11:00
Matt Joiner 04beb8937f More consistent cancellation management 2021-12-12 18:35:02 +11:00
Matt Joiner 1bc84e316f Don't group Torrent piece request orders without a storage capacity together 2021-12-12 18:35:02 +11:00
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