A few adjustments to prioritized peers usage
This commit is contained in:
parent
cefcda18c6
commit
df38775630
|
@ -943,7 +943,7 @@ func (cl *Client) newTorrent(ih metainfo.Hash, specStorage storage.ClientImpl) (
|
|||
cl: cl,
|
||||
infoHash: ih,
|
||||
peers: prioritizedPeers{
|
||||
om: btree.New(2),
|
||||
om: btree.New(32),
|
||||
getPrio: func(p Peer) peerPriority {
|
||||
return bep40PriorityIgnoreError(cl.publicAddr(p.IP), p.addr())
|
||||
},
|
||||
|
|
|
@ -258,8 +258,10 @@ func (t *Torrent) addPeer(p Peer) {
|
|||
}
|
||||
t.openNewConns()
|
||||
for t.peers.Len() > cl.config.TorrentPeersHighWater {
|
||||
t.peers.DeleteMin()
|
||||
torrent.Add("peers discarded", 1)
|
||||
_, ok := t.peers.DeleteMin()
|
||||
if ok {
|
||||
torrent.Add("excess reserve peers discarded", 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue