Commit Graph

3053 Commits

Author SHA1 Message Date
Matt Joiner 4258ff7c60 Add missing request updates on cancels, rejects 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 198a938700 Optimize Peer.peerHasWantedPieces 2021-10-19 14:08:56 +11:00
Matt Joiner 5e8f61abb5 Optimize request updates due to conn and reader state changes 2021-10-19 14:08:56 +11:00
Matt Joiner 4f87eed81a Extend nominal max requests upper bound to 2048 2021-10-19 14:08:56 +11:00
Matt Joiner dfc421824c Use a flat slice for pending request counts
Under heavy load, seems to be 2-3x faster.
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 ced0f543d6 Ignore request strategy run gobs and envrcs 2021-10-19 14:08:56 +11:00
Matt Joiner 10b9e88356 Implement pending requests using BSI 2021-10-19 14:08:56 +11:00
Matt Joiner 9aff9f3592 Extract pendingRequests 2021-10-19 14:08:56 +11:00
Matt Joiner 2be5a95b06 Add reasons for updateRequests to be triggered 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 3ef8cfba27 Log handshook conn run errors with level warning
(cherry picked from commit 7ca7890e9f30307a1f4942e6d987791a142c3cb3)
2021-10-19 14:07:48 +11:00
Matt Joiner 58cc0f3d87 Ending a conn because we don't like its ID is not an error
(cherry picked from commit 2a5ba846cef9b4e035b3b88698f3e7f7d9d79251)
2021-10-19 14:07:40 +11:00
Matt Joiner c18e0abe52 Fix incomplete Integer.Read
Possibly on read buffer boundaries, this would have caused errant io.ErrUnexpectedEOF.

(cherry picked from commit 22569449dad48e1c5cdeac171625585f8ca976c9)
2021-10-19 14:07:23 +11:00
Matt Joiner d19079e698 Only allow chunk size to be set for new Torrents
(cherry picked from commit 09e73e9fce139cd78da48c442e8610501b6fd26b)
2021-10-19 14:04:07 +11:00
Matt Joiner 6f196c8d33 Update piece priority after processing piece hash result
Seems to avoid some silly performance issues in triggering request updates due to a piece still pending while being marked.
2021-10-19 14:03:03 +11:00
Matt Joiner 329578520a Pieces being marked should have priority none
Also reorder the checks a bit to favour the cheaper ones.
2021-10-19 14:00:52 +11:00
Simon Kirsten 637045c19a
Add DisableInitialPieceCheck option (#677) 2021-10-11 11:33:40 +11:00
Matt Joiner 1b78a9bcc6 Update requests on unchoke 2021-10-07 17:20:04 +11:00
Matt Joiner 4d496bf756 cmd/torrent: Ensure envpprof.Stop runs before exit 2021-10-07 17:00:39 +11:00
Matt Joiner 15a2d3fb23 go mod tidy
Fixes broken go doc: https://github.com/golang/go/issues/36811#issuecomment-937401816
2021-10-07 13:56:45 +11:00
Matt Joiner 72a06d88fc Add TorrentStats.PiecesComplete
Fixes https://github.com/anacrolix/torrent/issues/352.
2021-10-07 13:50:13 +11:00
Matt Joiner 62c83a5b9c Add to tests for Torrent.Complete 2021-10-07 13:38:29 +11:00
Matt Joiner f47a12bd32 Return errors from Client.Close 2021-10-07 13:31:08 +11:00
Matt Joiner 28e9064288 Fix comment that seems to mess with GoLand's package structure 2021-10-07 12:09:52 +11:00
Matt Joiner c9c137d8f2 Add a flag for Complete 2021-10-07 12:09:20 +11:00
Matt Joiner 81c47d5705 Upgrade Torrent.GotInfo 2021-10-07 11:50:30 +11:00
Matt Joiner 9720fd576d Update chansync 2021-10-07 11:45:09 +11:00
Matt Joiner 118391c3bf Apply some lints from GoLand 2021-10-07 09:12:17 +11:00
Matt Joiner 11ae25660a Remove old-style build tags 2021-10-07 09:12:17 +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 fd8995dcfd go fmt ./... 2021-10-05 17:48:52 +11:00
Matt Joiner da1221dd50 Change Peer._peerPieces to use raw roaring Bitmap type
The wrapper type was from when roaring didn't support zero-alloc initialization.
2021-10-05 17:48:34 +11:00
Matt Joiner 719d5c6400 Wrap error with %w in mainReadLoop 2021-09-30 12:01:56 +10:00
Matt Joiner 846167c63e Fix mainReadLoop benchmark 2021-09-30 12:01:34 +10:00
Matt Joiner 4ed855070f Fix scheduling overhead in decoding benchmark 2021-09-30 11:52:50 +10:00
Matt Joiner 702cf3c8f7 Combine peer protocol fuzz targets into one file 2021-09-30 11:19:50 +10:00
Matt Joiner 2027028539 More optimizations in peer protocol message decoding 2021-09-30 11:05:01 +10:00
Matt Joiner 73696fd215 peer_protocol: Use faster form for Integer.{UnmarshalBinary,Read} 2021-09-30 10:24:03 +10:00
Matt Joiner 60a622ff4b Remove an allocation reading message length 2021-09-30 09:59:18 +10:00
Matt Joiner 709ee70b0c Try to avoid allocating buffer 2021-09-30 09:45:50 +10:00
Matt Joiner b69e6dff01 Improvements to decoder fuzzing 2021-09-30 09:42:54 +10:00
Matt Joiner 1b66994c0a Add some fuzzing in peer_protocol 2021-09-30 09:01:10 +10:00
Matt Joiner 6156aebf71 Limit decoded bencode string lengths to 32 bits
Found in fuzzing
2021-09-29 16:56:01 +10:00
Matt Joiner fcf65ee56a Add some fuzzing seeds 2021-09-29 12:12:16 +10:00
Matt Joiner 10ecd4390a Fix parsing of strings that don't fit in memory 2021-09-29 12:11:58 +10:00