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

72 Commits

Author SHA1 Message Date
Matt Joiner
669c69faac
Disable update requests timer 2022-05-12 10:37:36 +10:00
Matt Joiner
590d1ac265
Make piece states a slice and reuse it and request indexes between runs 2022-05-12 10:37:36 +10:00
Matt Joiner
4eb6a49f27
Use intermediate t in Peer.getDesiredRequestState 2022-05-12 10:37:36 +10:00
Matt Joiner
f235c8ea51
Reuse piece order state for request ordering 2022-05-12 10:34:28 +10:00
Matt Joiner
7d4f64ce3c
Combine pending and last requested 2022-05-11 11:33:11 +10:00
Matt Joiner
e90037216c
Use a generic heap implementation for request selection 2022-05-09 12:05:50 +10:00
Matt Joiner
7e362c0cb3
Order readahead requests by piece index 2022-05-09 12:05:50 +10:00
Matt Joiner
9a9c7dee00
Add and use typed roaring bitmap 2022-05-09 12:05:50 +10:00
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