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,
|
cl: cl,
|
||||||
infoHash: ih,
|
infoHash: ih,
|
||||||
peers: prioritizedPeers{
|
peers: prioritizedPeers{
|
||||||
om: btree.New(2),
|
om: btree.New(32),
|
||||||
getPrio: func(p Peer) peerPriority {
|
getPrio: func(p Peer) peerPriority {
|
||||||
return bep40PriorityIgnoreError(cl.publicAddr(p.IP), p.addr())
|
return bep40PriorityIgnoreError(cl.publicAddr(p.IP), p.addr())
|
||||||
},
|
},
|
||||||
|
|
|
@ -258,8 +258,10 @@ func (t *Torrent) addPeer(p Peer) {
|
||||||
}
|
}
|
||||||
t.openNewConns()
|
t.openNewConns()
|
||||||
for t.peers.Len() > cl.config.TorrentPeersHighWater {
|
for t.peers.Len() > cl.config.TorrentPeersHighWater {
|
||||||
t.peers.DeleteMin()
|
_, ok := t.peers.DeleteMin()
|
||||||
torrent.Add("peers discarded", 1)
|
if ok {
|
||||||
|
torrent.Add("excess reserve peers discarded", 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue