From dea0e41e2908772ca012637e8a4bd0f820ebef11 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Fri, 12 Nov 2021 13:51:58 +1100 Subject: [PATCH] Boost webseed max requests --- torrent.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/torrent.go b/torrent.go index 80ad8e4b..b9ecb0f6 100644 --- a/torrent.go +++ b/torrent.go @@ -2193,15 +2193,21 @@ func (t *Torrent) addWebSeed(url string) { if _, ok := t.webSeeds[url]; ok { return } - const maxRequests = 10 + // I don't think Go http supports pipelining requests. However we can have more ready to go + // right away. This value should be some multiple of the number of connections to a host. I + // would expect that double maxRequests plus a bit would be appropriate. + const maxRequests = 32 ws := webseedPeer{ peer: Peer{ t: t, outgoing: true, Network: "http", reconciledHandshakeStats: true, - // TODO: Raise this limit, and instead limit concurrent fetches. - PeerMaxRequests: 32, + // This should affect how often we have to recompute requests for this peer. Note that + // because we can request more than 1 thing at a time over HTTP, we will hit the low + // requests mark more often, so recomputation is probably sooner than with regular peer + // conns. ~4x maxRequests would be about right. + PeerMaxRequests: 128, RemoteAddr: remoteAddrFromUrl(url), callbacks: t.callbacks(), }, -- 2.48.1