]> Sergey Matveev's repositories - btrtrc.git/blobdiff - torrent.go
Apply download rate limiter to webseeds
[btrtrc.git] / torrent.go
index 0f3603749337f64f1606d758d5f602c7dae1352f..706092740830a19abad6ba5e2db431a156e4c417 100644 (file)
@@ -2273,6 +2273,12 @@ func (t *Torrent) addWebSeed(url string) {
                client: webseed.Client{
                        HttpClient: t.cl.webseedHttpClient,
                        Url:        url,
+                       ResponseBodyWrapper: func(r io.Reader) io.Reader {
+                               return &rateLimitedReader{
+                                       l: t.cl.config.DownloadRateLimiter,
+                                       r: r,
+                               }
+                       },
                },
                activeRequests: make(map[Request]webseed.Request, maxRequests),
                maxRequests:    maxRequests,