]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Boost webseed max requests
authorMatt Joiner <anacrolix@gmail.com>
Fri, 12 Nov 2021 02:51:58 +0000 (13:51 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Fri, 12 Nov 2021 02:51:58 +0000 (13:51 +1100)
torrent.go

index 80ad8e4b377d4fe0629837850eed933cb3be42e2..b9ecb0f636ac0764f25f395cd71bdcb38bd06224 100644 (file)
@@ -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(),
                },