i am dumb

This commit is contained in:
dr7ana 2023-12-07 17:28:08 -08:00
parent 5803393bff
commit c8553736a5
3 changed files with 10 additions and 3 deletions

View File

@ -46,7 +46,8 @@ namespace llarp
void
randomize()
{
current = std::next(begin(), std::uniform_int_distribution<size_t>{0, size() - 1}(csrng));
if (size() > 1)
current = std::next(begin(), std::uniform_int_distribution<size_t>{0, size() - 1}(csrng));
}
void

View File

@ -196,7 +196,8 @@ namespace llarp
{
// TODO: if this needs to be called more than once (ex: drastic failures), then
// change this assert to a bootstraps.clear() call
assert(_bootstraps->empty());
if (_bootstraps)
assert(_bootstraps->empty());
_bootstraps = std::move(from_router);
_bootstraps->randomize();

View File

@ -670,6 +670,8 @@ namespace llarp
if (_bootstrap_rc_list->empty() and not conf.bootstrap.seednode)
{
log::warning(logcat, "Warning: bootstrap list is empty and we are not a seed node");
auto fallbacks = llarp::load_bootstrap_fallbacks();
if (auto itr = fallbacks.find(RouterContact::ACTIVE_NETID); itr != fallbacks.end())
@ -692,9 +694,12 @@ namespace llarp
log::info(
logcat, "Loaded {} default fallback bootstrap routers!", _bootstrap_rc_list->size());
clear_bad_rcs();
node_db()->set_bootstrap_routers(std::move(_bootstrap_rc_list));
}
log::critical(logcat, "We have {} bootstrap routers!", _bootstrap_rc_list->size());
node_db()->set_bootstrap_routers(std::move(_bootstrap_rc_list));
if (conf.bootstrap.seednode)
log::critical(logcat, "We are a bootstrap seed node!");