network: take into account good known peers when thinking of GetAddr

They will be returned to pool when disconnected anyway. On a smaller network
this can make a difference because there are not a lot of addresses in the
pool usually.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
Roman Khimov 2024-12-06 15:28:26 +03:00
parent 2bc41dbe30
commit 703bf6c458

View file

@ -499,7 +499,7 @@ func (s *Server) run() {
s.discovery.RequestRemote(min(s.AttemptConnPeers, optimalN-peerN))
}
if addrCheckTimeout || s.discovery.PoolCount() < s.AttemptConnPeers {
if addrCheckTimeout || s.discovery.PoolCount()+peerN < s.AttemptConnPeers {
s.broadcastHPMessage(NewMessage(CMDGetAddr, payload.NewNullPayload()))
addrCheckTimeout = false
}