From 8bd9819c20425096c90d2bd8391c0c8d1b2fc9d3 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 24 Apr 2025 23:04:33 +1000 Subject: [PATCH] Change ClientConfig.MaxAllocPeerRequestDataPerConn to be an int --- client.go | 2 +- cmd/torrent/download.go | 2 +- config.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index f1d29d06..34a51644 100644 --- a/client.go +++ b/client.go @@ -1683,7 +1683,7 @@ func (cl *Client) newConnection(nc net.Conn, opts newConnectionOpts) (c *PeerCon connString: opts.connString, conn: nc, } - c.peerRequestDataAllocLimiter.Max = cl.config.MaxAllocPeerRequestDataPerConn + c.peerRequestDataAllocLimiter.Max = int64(cl.config.MaxAllocPeerRequestDataPerConn) c.initRequestState() // TODO: Need to be much more explicit about this, including allowing non-IP bannable addresses. if opts.remoteAddr != nil { diff --git a/cmd/torrent/download.go b/cmd/torrent/download.go index 79371a7b..7fae9dfb 100644 --- a/cmd/torrent/download.go +++ b/cmd/torrent/download.go @@ -375,7 +375,7 @@ func downloadErr(ctx context.Context, flags downloadFlags) error { clientConfig.DisableWebtorrent = !flags.Webtorrent clientConfig.NoDefaultPortForwarding = !flags.PortForward if flags.MaxAllocPeerRequestDataPerConn != nil { - clientConfig.MaxAllocPeerRequestDataPerConn = flags.MaxAllocPeerRequestDataPerConn.Int64() + clientConfig.MaxAllocPeerRequestDataPerConn = int(flags.MaxAllocPeerRequestDataPerConn.Int64()) } if flags.PackedBlocklist != "" { blocklist, err := iplist.MMapPackedFile(flags.PackedBlocklist) diff --git a/config.go b/config.go index 76979463..0ec0df00 100644 --- a/config.go +++ b/config.go @@ -152,7 +152,7 @@ type ClientConfig struct { // to maintain. KeepAliveTimeout time.Duration // Maximum bytes to buffer per peer connection for peer request data before it is sent. - MaxAllocPeerRequestDataPerConn int64 + MaxAllocPeerRequestDataPerConn int // The IP addresses as our peers should see them. May differ from the // local interfaces due to NAT or other network configurations. -- 2.48.1