client.go | 6 +++--- connection.go | 6 +++--- diff --git a/client.go b/client.go index 447958e63ca35f7cad6870c32184c6d7d08cc1a2..673f6e5da6b017f4b12bb266e5fc7bbdde8b5b2a 100644 --- a/client.go +++ b/client.go @@ -1277,7 +1277,7 @@ cn.peerHasAll = true cn.PeerPieces = nil if t.haveInfo() { for i := 0; i < t.numPieces(); i++ { - cl.peerGotPiece(t, cn, i) + cn.peerGotPiece(i) } } } @@ -1385,7 +1385,7 @@ case pp.NotInterested: c.PeerInterested = false c.Choke() case pp.Have: - me.peerGotPiece(t, c, int(msg.Index)) + c.peerGotPiece(int(msg.Index)) case pp.Request: if c.Choked { break @@ -1427,7 +1427,7 @@ } c.PeerPieces = msg.Bitfield for index, has := range c.PeerPieces { if has { - me.peerGotPiece(t, c, index) + c.peerGotPiece(index) } } case pp.HaveAll: diff --git a/connection.go b/connection.go index 1db26869db248fed427fd9be5be6e992b5700991..fd64700249620526d965b3f023a12e97cd9f4406 100644 --- a/connection.go +++ b/connection.go @@ -626,11 +626,11 @@ c.t.putPieceInclination(c.pieceInclination) c.pieceInclination = nil } -func (me *Client) peerGotPiece(t *torrent, c *connection, piece int) error { +func (c *connection) peerGotPiece(piece int) error { if !c.peerHasAll { - if t.haveInfo() { + if c.t.haveInfo() { if c.PeerPieces == nil { - c.PeerPieces = make([]bool, t.numPieces()) + c.PeerPieces = make([]bool, c.t.numPieces()) } } else { for piece >= len(c.PeerPieces) {