connection.go | 6 ++++-- diff --git a/connection.go b/connection.go index be44a29048b5e0791088a21c965a14d334e040a1..7eb9ec3572a76bc56cecd4f48abd8f5643edfc84 100644 --- a/connection.go +++ b/connection.go @@ -780,7 +780,7 @@ err = c.peerSentHaveAll() case pp.HaveNone: err = c.peerSentHaveNone() case pp.Piece: - cl.downloadedChunk(t, c, &msg) + c.downloadedChunk(&msg) if len(msg.Piece) == int(t.chunkSize) { t.chunkPool.Put(msg.Piece) } @@ -928,7 +928,9 @@ }{cn.r, cn.w} } // Handle a received chunk from a peer. -func (cl *Client) downloadedChunk(t *Torrent, c *connection, msg *pp.Message) { +func (c *connection) downloadedChunk(msg *pp.Message) { + t := c.t + cl := t.cl chunksReceived.Add(1) req := newRequest(msg.Index, msg.Begin, pp.Integer(len(msg.Piece)))