Commit Graph

3134 Commits

Author SHA1 Message Date
Matt Joiner e7ee568c52 Fix BenchmarkConnectionMainReadLoop
Broken by piece request order changes.
2021-12-16 14:00:19 +11:00
Matt Joiner 1668a18859 Some optimizations in PieceRequestOrder.Update and item comparisons 2021-12-15 19:18:16 +11:00
Matt Joiner 8c129d6bfc Retract v1.39.0 2021-12-13 12:16:43 +11:00
Matt Joiner c0a888ee17 Tidy up request heaping comments 2021-12-13 12:12:30 +11:00
Matt Joiner 9d9556c97f Add Peer.cancelAllRequests for webseedPeer 2021-12-13 12:11:38 +11:00
Matt Joiner 98f188dcbe Update requests after deleting all in some corner cases
Choked by non-fast PeerConn, deleted PeerConn. They're not exactly guarded as strictly as they could be, so there's plenty of room for performance improvements here.
2021-12-13 12:09:12 +11:00
Matt Joiner 47ef8d9c2d Assert that a request isn't cancelled before requesting it again 2021-12-13 11:56:57 +11:00
Matt Joiner a671c06b94 Update peer requests if not interested when piece priorities change
This should fix a starvation issue where we don't signal interest to a peer that has us choked.
2021-12-13 11:55:47 +11:00
Matt Joiner 26b521b41c Explicitly use go-libutp synchronous firewall callback 2021-12-12 21:32:29 +11:00
Matt Joiner 3d3052b8bd Merge branch 'request-strategy-experiments'
This should bring in significant performance improvements that fix issues with the peer-requesting that existed from v1.34.0.
2021-12-12 18:38:33 +11:00
Matt Joiner 04beb8937f More consistent cancellation management 2021-12-12 18:35:02 +11:00
Matt Joiner 30375615b3 Remove unused request strategy code 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 8c5df03e14 Minimize allocations due to heap escapes 2021-12-12 18:35:01 +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 aca22a0896 Update peer cancel assumptions and return 2021-12-12 18:35:01 +11:00
Matt Joiner 1b92249f2a Improve panic message 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 8025d15155 Stop iterating pieces when storage is exhausted 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 b99dd505b5 Avoid reflection sorting request pieces 2021-12-12 18:35:01 +11:00
Matt Joiner de2bea502c Use indices to lookup pieces for comparison 2021-12-12 18:35:01 +11:00
Matt Joiner 231301f5d7 Cache piece request orderings 2021-12-12 18:35:01 +11:00
Matt Joiner 8e99558e11 Retract last few minor versions with peer-requesting issues
(cherry picked from commit 85a436a5ca75a47a52dcab9648d85f3c3fb53e35)
2021-12-12 18:34:31 +11:00
Matt Joiner cd9a3a14ad Revert "Link to godocs.io for documentation"
This reverts commit c2ed60f9f2.
2021-12-12 17:20:02 +11:00
Matt Joiner 67ed5d0032 Partition piece request strategy by storage capacity key 2021-12-12 16:56:01 +11:00
Matt Joiner ad082bc644 Do webseed request updates asynchronously
Fixes a bug where received chunks are immediately requested while still being processed.
2021-12-12 16:56:01 +11:00
Matt Joiner 6625b05da4 Add more identifying information to PeerConn.String
Some logs for unexpected protocol violations could be helped by them.
2021-12-12 16:56:01 +11:00
Matt Joiner 1d787c3923 Add generalized decodeJsonByteString and a fuzz target for it 2021-12-12 16:56:01 +11:00
Matt Joiner 14ee69aaeb Add failing bencode fuzz input 2021-12-12 16:56:01 +11:00
Matt Joiner 96ef73aeb6 Transmission does not reject cancelled requests 2021-12-12 16:56:01 +11:00
Matt Joiner 388bfafa01 Don't log webseed request context cancellation results 2021-12-12 16:56:01 +11:00
Matt Joiner cd7e6dcd5c bencode: Avoid allocating interface string up front
This should fix crashes during fuzzing. It's not a complete fix, we really want to limit the amount a given Decode can allocate. Maybe Go isn't the right language for this.
2021-12-12 16:56:01 +11:00
Matt Joiner 79511abe6c bencode: Fix decoding integer with leading + 2021-12-12 16:56:01 +11:00
Matt Joiner 8764456d23 bencode: Enforce dict key ordering
Fix bencode dict key ordering in HTTP tracker test
2021-12-12 16:56:01 +11:00
Matt Joiner 78e48f71dd bencode incorrectly parsed integers with leading zeroes 2021-12-12 16:56:01 +11:00
Matt Joiner 42dca16753 Add bencode FuzzInterfaceRoundTrip 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 4913f17c01 Generate full sintel magnet link in fs test 2021-12-12 15:01:50 +11:00
Matt Joiner e16c799638 Add sintel.torrent 2021-12-12 15:01:50 +11:00
Matt Joiner 8dc897d4a2 Fix races using resources on Close 2021-12-12 15:01:50 +11:00
Matt Joiner 69f3b6064e Don't use the Client's IP blocklist after the Client is closed
Fixes a segfault due to using a memory mapped blocklist in confluence.
2021-12-12 15:01:50 +11:00
Matt Joiner 54d529aac0 Remove unused torrent_pending_pieces.go
Unfortunately github.com/elliotchance/orderedmap is still used in ./analysis, so no deps are removed.
2021-12-12 15:01:50 +11:00
Matt Joiner ba592028e5 Filter update requests on piece priority change by peer choking and allowed fast 2021-12-12 15:01:50 +11:00