Commit Graph

82 Commits

Author SHA1 Message Date
Matt Joiner 6e8634e971
Break up long condition expression 2024-01-15 12:55:32 +11:00
Matt Joiner bdcb6c9fcd
Fix requests still being made when downloading is disallowed
https://github.com/anacrolix/torrent/issues/889
2024-01-15 12:55:04 +11:00
Matt Joiner 87f6cdc1e9
Fix request heap pop bug
Missed in the changed interface from 613470861e. Caused very poor performance. Thanks to @AskAlexSharov for raising the flag in https://github.com/anacrolix/torrent/issues/859#issuecomment-1706059960.
2023-09-11 10:10:13 +10:00
Matt Joiner 613470861e
Ditch lispad/go-generics-tools for anacrolix/generics/heap
Fixes https://github.com/anacrolix/torrent/issues/859
2023-08-16 21:02:01 +10:00
Matt Joiner 8ac9ea890e
Don't panic if changing interest fills the write buffer
This was the old behaviour, years ago. I don't know why it's suddenly being triggered lately.
2023-05-19 14:09:27 +10:00
Matt Joiner a4989ec165
Camel case requestStrategy package 2023-04-29 14:54:49 +10:00
Matt Joiner d3b3d2d9bf
Finish moving all Peer types and methods into peer.go 2023-03-01 12:34:16 +11:00
Matt Joiner 3e0f34934d
gorond ./... 2022-11-15 23:31:27 +11:00
Matt Joiner 39bd8fc5a0
Use reusable roaring iterators 2022-05-12 10:42:16 +10:00
Matt Joiner 0235dd3801
Add fallback piece ordering for non-readahead priorities 2022-05-12 10:37:50 +10:00
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