]> Sergey Matveev's repositories - btrtrc.git/blobdiff - tracker/http/client.go
Add http tracker AllowKeepAlive
[btrtrc.git] / 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,
                        },
                },
        }