cn.PeerPieces = nil
if t.haveInfo() {
for i := 0; i < t.numPieces(); i++ {
- cl.peerGotPiece(t, cn, i)
+ cn.peerGotPiece(i)
}
}
}
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
c.PeerPieces = msg.Bitfield
for index, has := range c.PeerPieces {
if has {
- me.peerGotPiece(t, c, index)
+ c.peerGotPiece(index)
}
}
case pp.HaveAll:
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) {