p2p: stop dialing at half the maximum peer count

This commit is contained in:
Felix Lange 2015-05-06 23:44:51 +02:00
parent 6a2fec5309
commit 3e2a928caa

View File

@ -360,7 +360,7 @@ func (srv *Server) dialLoop() {
case <-refresh.C: case <-refresh.C:
// Grab some nodes to connect to if we're not at capacity. // Grab some nodes to connect to if we're not at capacity.
srv.lock.RLock() srv.lock.RLock()
needpeers := len(srv.peers) < srv.MaxPeers needpeers := len(srv.peers) < srv.MaxPeers/2
srv.lock.RUnlock() srv.lock.RUnlock()
if needpeers { if needpeers {
go func() { go func() {