]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Deprecate WebSeedTorrentMaxRequests
authorMatt Joiner <anacrolix@gmail.com>
Thu, 3 Jul 2025 06:04:52 +0000 (16:04 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 3 Jul 2025 06:17:52 +0000 (16:17 +1000)
deprecated.go
torrent.go

index 6836c598f8d7078546a8f5a88278bcf593e4f155..6c185fe2a432366d27a726f17d1d5329257ecd7e 100644 (file)
@@ -1,7 +1,20 @@
 package torrent
 
+import (
+       "github.com/anacrolix/torrent/webseed"
+)
+
 // Deprecated: The names doesn't reflect the actual behaviour. You can only add sources. Use
 // AddSources instead.
 func (t *Torrent) UseSources(sources []string) {
        t.AddSources(sources)
 }
+
+// Deprecated: Max requests are done Client-wide by host or cost-function applied to the webseed
+// URL. Max concurrent requests to a WebSeed for a given torrent. This could easily be reimplemented
+// by not assigning requests to a (Torrent, webseed URL) tuple keyed component in the webseed plan.
+func WebSeedTorrentMaxRequests(maxRequests int) AddWebSeedsOpt {
+       return func(c *webseed.Client) {
+               c.MaxRequests = maxRequests
+       }
+}
index d681c8684b2d2ca7591fb0136d06193c6cd12e40..6ba0858a403451036c8afa9d96d433a510e65f0d 100644 (file)
@@ -2999,13 +2999,6 @@ type AddWebSeedsOpt func(*webseed.Client)
 
 // TODO: Add a webseed http.Client option.
 
-// Max concurrent requests to a WebSeed for a given torrent.
-func WebSeedTorrentMaxRequests(maxRequests int) AddWebSeedsOpt {
-       return func(c *webseed.Client) {
-               c.MaxRequests = maxRequests
-       }
-}
-
 // Sets the WebSeed trailing path escaper for a webseed.Client.
 func WebSeedPathEscaper(custom webseed.PathEscaper) AddWebSeedsOpt {
        return func(c *webseed.Client) {
@@ -3040,7 +3033,8 @@ func (t *Torrent) addWebSeed(url string, opts ...AddWebSeedsOpt) bool {
        // number is based on keeping at least one connection actively downloading while another request
        // is fired off, and ensuring race detection works. Downloading Sintel
        // (08ada5a7a6183aae1e09d831df6748d566095a10) from "https://webtorrent.io/torrents/" is a good
-       // test.
+       // test. Note since per-Torrent max requests for webseeds is not active, this doesn't do
+       // anything.
        const defaultMaxRequests = 2
        ws := webseedPeer{
                peer: Peer{