minor cleanup in automatic connections_limit management
This commit is contained in:
parent
4733670aa1
commit
2b53eb28a9
|
@ -2590,7 +2590,8 @@ retry:
|
||||||
i->second->disconnect_peers(1, e);
|
i->second->disconnect_peers(1, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_settings.set_int(settings_pack::connections_limit, m_connections.size());
|
m_settings.set_int(settings_pack::connections_limit
|
||||||
|
, std::max(10, int(m_connections.size())));
|
||||||
}
|
}
|
||||||
// try again, but still alert the user of the problem
|
// try again, but still alert the user of the problem
|
||||||
async_accept(listener, ssl);
|
async_accept(listener, ssl);
|
||||||
|
@ -4230,9 +4231,8 @@ retry:
|
||||||
// we ran out of memory trying to connect to a peer
|
// we ran out of memory trying to connect to a peer
|
||||||
// lower the global limit to the number of peers
|
// lower the global limit to the number of peers
|
||||||
// we already have
|
// we already have
|
||||||
m_settings.set_int(settings_pack::connections_limit, num_connections());
|
m_settings.set_int(settings_pack::connections_limit
|
||||||
if (m_settings.get_int(settings_pack::connections_limit) < 2)
|
, std::max(2, num_connections()));
|
||||||
m_settings.set_int(settings_pack::connections_limit, 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
++steps_since_last_connect;
|
++steps_since_last_connect;
|
||||||
|
@ -6613,8 +6613,7 @@ retry:
|
||||||
{
|
{
|
||||||
int limit = m_settings.get_int(settings_pack::connections_limit);
|
int limit = m_settings.get_int(settings_pack::connections_limit);
|
||||||
|
|
||||||
if (limit <= 0)
|
if (limit <= 0) limit = max_open_files();
|
||||||
limit = (std::numeric_limits<int>::max)();
|
|
||||||
|
|
||||||
m_settings.set_int(settings_pack::connections_limit, limit);
|
m_settings.set_int(settings_pack::connections_limit, limit);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue