Commit Graph

3081 Commits

Author SHA1 Message Date
Matt Joiner 92d3e1ed6d Remove unused peerImpl methods 2021-10-20 16:35:45 +11:00
Matt Joiner 200f5e5140 go mod tidy 2021-10-20 11:36:48 +11:00
Matt Joiner 9625553fd2 Demote some recent logs to debug 2021-10-20 11:22:35 +11:00
Matt Joiner e31e191c8d Improve protocol behaviour logging 2021-10-20 11:22:20 +11:00
Matt Joiner 11e1080b40 go fmt 2021-10-19 14:08:56 +11:00
Matt Joiner e51accb3e2 Don't error receiving unchoke while already unchoked 2021-10-19 14:08:56 +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 2f01dbab80 Include pending cancel count in peer status 2021-10-19 14:08:56 +11:00
Matt Joiner aca3924c5e Don't panic on request refresh if there are no existing requests 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 700542de89 go mod tidy 2021-10-19 14:08:56 +11:00
Matt Joiner 98012dddb7 glr resolve anacrolix/args 2021-10-19 14:08:56 +11:00
Matt Joiner a7d3296003 Use roaring.Bitmap.IsEmpty where appropriate 2021-10-19 14:08:56 +11:00
Matt Joiner 7c349d31e2 Make useful data stat more readable 2021-10-19 14:08:56 +11:00
Matt Joiner 89e7e00c31 Print average download rate 2021-10-19 14:08:56 +11:00
Matt Joiner 181cbd3e52 Add expvar for successful peer wire protocol handshake peer reserved bytes 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 529aaa9b1f Use roaring bitmap for pending pieces
Also makes a significant optimization for peerHasWantedPieces possible.
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 3f3bcab0d8 Track requests that are preserved across chokings 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 5f31bd83b3 Some fixes to pending request accounting 2021-10-19 14:08:56 +11:00
Matt Joiner b2cabe7dbf Handle allowed fast while choked when requests already exist in the same piece 2021-10-19 14:08:56 +11:00
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