Commit Graph

38 Commits

Author SHA1 Message Date
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 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 04beb8937f More consistent cancellation management 2021-12-12 18:35:02 +11:00
Matt Joiner aca22a0896 Update peer cancel assumptions and return 2021-12-12 18:35: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 388bfafa01 Don't log webseed request context cancellation results 2021-12-12 16:56:01 +11:00
Matt Joiner a2c50ea2bd Handle 503 returns from webseed peer endpoints 2021-12-06 15:24:28 +11:00
Matt Joiner 32d9ec900c Record an observation about why webseed peers are doing most of the work in recent testing 2021-12-06 15:22:06 +11:00
Matt Joiner c653cf2070 Do webseed request parts sequentially
This means we can treat the number of bytes in the result with enough accuracy to decide if we should count it as a wasted chunk. Also I'm not sure why it was a good idea to do parts of a request in parallel anyway, it could just lead to spikes in outstanding requests to the webseed, rather than sticking to the predictable maxRequests limit.
2021-12-06 15:22:00 +11:00
Matt Joiner 9bee7c3bc4 Handle cancelled webseed peer requests if they're not active 2021-12-06 15:21:51 +11:00
Matt Joiner 56bb8a9713 Check if Torrent is closed before receiving webseed chunks 2021-12-06 15:19:00 +11:00
Matt Joiner 63b7215892 Improve error handling for bad webseeds
DNS "no such host" errors didn't interrupt the stream of outbound requests.
2021-11-12 14:43:22 +11:00
Matt Joiner a7dff20e3f Increment webseed peer piece availability 2021-11-12 13:41:55 +11:00
Matt Joiner 2fd928b918 Don't use non-directory webseed URLs for multi-file torrents 2021-11-12 12:37:40 +11:00
Matt Joiner 28726f737c Record webseed request result bytes against client stats
Should fix the issue where webseeds cause >100% useful data readings.
2021-10-25 16:17:55 +11:00
Matt Joiner ff3c186396 Add low requests check
This is an optimization for webseeds, which have 10 synchronous request routines, and if the request count dips below 10, some sit idle. There is probably something similar to be done with PeerConns, which won't update until there are zero requests, but there there is a timer to refresh updates, and the queues are very long (typically 512-2048).
2021-10-21 10:48:43 +11:00
Matt Joiner 8eec0b665e Update webseeds for peer requesting 2021-10-21 10:28:57 +11:00
Matt Joiner 92d3e1ed6d Remove unused peerImpl methods 2021-10-20 16:35:45 +11:00
Matt Joiner a7d3296003 Use roaring.Bitmap.IsEmpty where appropriate 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 16c571b58b Add pprof labels for request updates and remove Client-wide requester 2021-10-19 14:08:13 +11:00
Matt Joiner 1d2d1a9cde Store peer requests in a bitmap 2021-09-19 15:16:37 +10:00
Matt Joiner c895a21a16 Track chunks read for webseed peers too 2021-06-07 13:01:40 +10:00
Matt Joiner 36f52d7a14 Apply next request state asynchronously 2021-06-07 13:01:40 +10:00
Matt Joiner 6e97ce952f Tidy up request and cancel 2021-06-07 13:01:39 +10:00
Matt Joiner 0830589b0a Pass tests with new full-client request strategy implementation 2021-06-07 13:01:39 +10:00
Matt Joiner af0ade5496 Treat 404 responses from webseed peers as fatal
Fixes #464.
2021-02-18 14:36:08 +11:00
Matt Joiner 0cc655deed Fix closing of webseed peers 2021-02-09 19:21:54 +11:00
Matt Joiner 60e992ec97 Rework webseed peers to use a pool of requesters
This fixes the limitation that the max outstanding requests for a webseed peer must match the request concurrency. It should mean less recalculation, and more pipelining.
2021-01-29 16:01:35 +11:00
Matt Joiner 1ac5811990 Remove requests as soon as chunk data is received
Note that this breaks the backpressure on webseed responses again, and should be fixed shortly.
2021-01-28 16:36:35 +11:00
Matt Joiner 456a2f7c5d Expose more callbacks and Request and ChunkSpec 2021-01-28 14:23:22 +11:00
Matt Joiner 27108bd2f7 Export Peer 2021-01-25 15:49:48 +11:00
Matt Joiner 133cc17c00 Some peerImpl observations 2021-01-04 15:51:23 +11:00
Matt Joiner 0b726a899b We might want to close webseed peers on response errors 2020-10-15 12:45:19 +11:00
Matt Joiner 1cdae13700 Fix conn status string for WebRTC connections 2020-09-29 16:21:54 +10:00
Matt Joiner 4e541951eb Handle errors in webseed peers for bad URLs 2020-07-10 13:18:33 +10:00
Matt Joiner 12ace95493 Tidy up webseed peer naming and unused types 2020-06-04 11:58:18 +10:00