Reuse pieceRequestOrder slice

This commit is contained in:
Matt Joiner 2021-05-10 17:42:51 +10:00
parent 99a7cb9291
commit 875ead3582
2 changed files with 4 additions and 1 deletions

View File

@ -81,6 +81,8 @@ type Client struct {
websocketTrackers websocketTrackers
activeAnnounceLimiter limiter.Instance
pieceRequestOrder clientPieceRequestOrder
}
type ipStr string

View File

@ -87,7 +87,8 @@ func (cl *Client) requester() {
}
func (cl *Client) doRequests() {
requestOrder := clientPieceRequestOrder{}
requestOrder := &cl.pieceRequestOrder
requestOrder.pieces = requestOrder.pieces[:0]
allPeers := make(map[*Torrent][]*Peer)
// Storage capacity left for this run, keyed by the storage capacity pointer on the storage
// TorrentImpl.