diff --git a/go.mod b/go.mod index bf6439db..a23fd1ab 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/anacrolix/dht/v2 v2.16.2-0.20220311024416-dd658f18fd51 github.com/anacrolix/envpprof v1.2.1 github.com/anacrolix/fuse v0.2.0 - github.com/anacrolix/generics v0.0.0-20220510042907-b50562b436ec + github.com/anacrolix/generics v0.0.0-20220618083756-f99e35403a60 github.com/anacrolix/go-libutp v1.2.0 github.com/anacrolix/log v0.13.1 github.com/anacrolix/missinggo v1.3.0 diff --git a/go.sum b/go.sum index 99a8cad6..9b257b75 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,8 @@ github.com/anacrolix/envpprof v1.2.1 h1:25TJe6t/i0AfzzldiGFKCpD+s+dk8lONBcacJZB2 github.com/anacrolix/envpprof v1.2.1/go.mod h1:My7T5oSqVfEn4MD4Meczkw/f5lSIndGAKu/0SM/rkf4= github.com/anacrolix/fuse v0.2.0 h1:pc+To78kI2d/WUjIyrsdqeJQAesuwpGxlI3h1nAv3Do= github.com/anacrolix/fuse v0.2.0/go.mod h1:Kfu02xBwnySDpH3N23BmrP3MDfwAQGRLUCj6XyeOvBQ= -github.com/anacrolix/generics v0.0.0-20220510042907-b50562b436ec h1:OnHX2MpnlLBBee06jcpL6eBppz766BnquXnZKH6iGgI= -github.com/anacrolix/generics v0.0.0-20220510042907-b50562b436ec/go.mod h1:ff2rHB/joTV03aMSSn/AZNnaIpUw0h3njetGsaXcMy8= +github.com/anacrolix/generics v0.0.0-20220618083756-f99e35403a60 h1:k4/h2B1gGF+PJGyGHxs8nmHHt1pzWXZWBj6jn4OBlRc= +github.com/anacrolix/generics v0.0.0-20220618083756-f99e35403a60/go.mod h1:ff2rHB/joTV03aMSSn/AZNnaIpUw0h3njetGsaXcMy8= github.com/anacrolix/go-libutp v1.2.0 h1:sjxoB+/ARiKUR7IK/6wLWyADIBqGmu1fm0xo+8Yy7u0= github.com/anacrolix/go-libutp v1.2.0/go.mod h1:RrJ3KcaDcf9Jqp33YL5V/5CBEc6xMc7aJL8wXfuWL50= github.com/anacrolix/log v0.3.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU= diff --git a/peerconn.go b/peerconn.go index c58745e2..989b2f81 100644 --- a/peerconn.go +++ b/peerconn.go @@ -366,7 +366,7 @@ func (cn *Peer) iterContiguousPieceRequests(f func(piece pieceIndex, count int)) count++ } else { if count != 0 { - f(last.Value(), count) + f(last.Value, count) } last = item count = 1 @@ -1400,8 +1400,8 @@ func (c *Peer) receiveChunk(msg *pp.Message) error { req := c.t.requestIndexFromRequest(ppReq) t := c.t - if c.bannableAddr.Ok() { - t.smartBanCache.RecordBlock(c.bannableAddr.Value(), req, msg.Piece) + if c.bannableAddr.Ok { + t.smartBanCache.RecordBlock(c.bannableAddr.Value, req, msg.Piece) } if c.peerChoking { diff --git a/t.go b/t.go index a20e02c8..de7965dc 100644 --- a/t.go +++ b/t.go @@ -147,7 +147,7 @@ func (t *Torrent) Name() string { // The completed length of all the torrent data, in all its files. This is // derived from the torrent info, when it is available. func (t *Torrent) Length() int64 { - return t._length.Value() + return t._length.Value } // Returns a run-time generated metainfo for the torrent that includes the diff --git a/torrent.go b/torrent.go index c8606ad8..7ce097fa 100644 --- a/torrent.go +++ b/torrent.go @@ -168,7 +168,7 @@ type Torrent struct { } func (t *Torrent) length() int64 { - return t._length.Value() + return t._length.Value } func (t *Torrent) selectivePieceAvailabilityFromPeers(i pieceIndex) (count int) { @@ -2157,7 +2157,7 @@ func (t *Torrent) dropBannedPeers() { t.iterPeers(func(p *Peer) { remoteIp := p.remoteIp() if remoteIp == nil { - if p.bannableAddr.Ok() { + if p.bannableAddr.Ok { t.logger.WithDefaultLevel(log.Debug).Printf("can't get remote ip for peer %v", p) } return