peerconn.go | 2 +- torrent.go | 4 ++-- diff --git a/peerconn.go b/peerconn.go index 5d1f718b55ba97e64c11ba97ab8bd92e08a61238..fda3b95fcdb093b2b105e41776a35d13355288a7 100644 --- a/peerconn.go +++ b/peerconn.go @@ -1030,7 +1030,7 @@ decoder := pp.Decoder{ R: bufio.NewReaderSize(c.r, 1<<17), MaxLength: 256 * 1024, - Pool: t.chunkPool, + Pool: &t.chunkPool, } for { var msg pp.Message diff --git a/torrent.go b/torrent.go index 70a8a9e1b7eb634cea7f8324389f4541033a8b8b..b719529f846b8ed5311da2d208a56d54a98afe6a 100644 --- a/torrent.go +++ b/torrent.go @@ -66,7 +66,7 @@ pieceStateChanges *pubsub.PubSub // The size of chunks to request from peers over the wire. This is // normally 16KiB by convention these days. chunkSize pp.Integer - chunkPool *sync.Pool + chunkPool sync.Pool // Total length of the torrent in bytes. Stored because it's not O(1) to // get this from the info dict. length *int64 @@ -233,7 +233,7 @@ } func (t *Torrent) setChunkSize(size pp.Integer) { t.chunkSize = size - t.chunkPool = &sync.Pool{ + t.chunkPool = sync.Pool{ New: func() interface{} { b := make([]byte, size) return &b