]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Add http tracker AllowKeepAlive
authorMatt Joiner <anacrolix@gmail.com>
Fri, 25 Jun 2021 05:00:09 +0000 (15:00 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Fri, 25 Jun 2021 05:00:09 +0000 (15:00 +1000)
tracker/http/client.go

index 30db36917ffdb26cbec5106b512d85ba2e4fb473..d0c27a023e8ec7e2496ae517c96702e797f979ca 100644 (file)
@@ -14,8 +14,9 @@ type Client struct {
 type ProxyFunc func(*http.Request) (*url.URL, error)
 
 type NewClientOpts struct {
-       Proxy      ProxyFunc
-       ServerName string
+       Proxy          ProxyFunc
+       ServerName     string
+       AllowKeepAlive bool
 }
 
 func NewClient(url_ *url.URL, opts NewClientOpts) Client {
@@ -29,7 +30,7 @@ func NewClient(url_ *url.URL, opts NewClientOpts) Client {
                                        ServerName:         opts.ServerName,
                                },
                                // This is for S3 trackers that hold connections open.
-                               DisableKeepAlives: true,
+                               DisableKeepAlives: !opts.AllowKeepAlive,
                        },
                },
        }