HAPPY NEW YEAR

pull/2228/head
dr7ana 5 months ago
parent 4c336c9ea1
commit 5469c9beb0

@ -442,6 +442,9 @@ namespace
cli.exit(e);
};
// TESTNET:
oxen::log::set_level("quic", oxen::log::Level::critical);
if (configFile.has_value())
{
// when we have an explicit filepath

@ -66,7 +66,6 @@ namespace llarp
}
router = makeRouter(loop);
nodedb = makeNodeDB();
if (!router->Configure(config, opts.isSNode, nodedb))

@ -94,9 +94,15 @@ namespace llarp
}
size_t
Endpoint::num_connected(bool clients_only) const
Endpoint::num_client_conns() const
{
return clients_only ? client_conns.size() : client_conns.size() + service_conns.size();
return client_conns.size();
}
size_t
Endpoint::num_router_conns() const
{
return service_conns.size();
}
void
@ -159,6 +165,16 @@ namespace llarp
[this, msg = std::move(m)]() mutable { handle_fetch_bootstrap_rcs(std::move(msg)); });
});
s->register_command("fetch_rcs"s, [this](oxen::quic::message m) {
_router.loop()->call(
[this, msg = std::move(m)]() mutable { handle_fetch_rcs(std::move(msg)); });
});
s->register_command("fetch_rids"s, [this](oxen::quic::message m) {
_router.loop()->call(
[this, msg = std::move(m)]() mutable { handle_fetch_router_ids(std::move(msg)); });
});
s->register_command("path_build"s, [this, rid = router_id](oxen::quic::message m) {
_router.loop()->call(
[this, &rid, msg = std::move(m)]() mutable { handle_path_build(std::move(msg), rid); });
@ -351,7 +367,8 @@ namespace llarp
if (msg.is_control)
{
log::critical(logcat, "Dispatching {} request!", *msg.endpoint);
log::critical(
logcat, "Dispatching {} request (stream ID: {})!", *msg.endpoint, str->stream_id());
str->command(std::move(*msg.endpoint), std::move(msg.body), std::move(msg.func));
}
else
@ -379,26 +396,27 @@ namespace llarp
void
LinkManager::on_conn_open(oxen::quic::connection_interface& ci)
{
_router.loop()->call([this, &conn_interface = ci]() {
_router.loop()->call([this, &conn_interface = ci, is_snode = _is_service_node]() {
const auto rid = RouterID{conn_interface.remote_key()};
const auto& remote = conn_interface.remote();
log::critical(
logcat,
"{} (RID:{}) ESTABLISHED CONNECTION TO RID:{}",
is_snode ? "SERVICE NODE" : "CLIENT",
_router.local_rid(),
rid);
if (conn_interface.is_inbound())
{
log::critical(logcat, "Inbound connection fom {} (remote:{})", rid, remote);
log::critical(logcat, "Inbound connection from {} (remote:{})", rid, remote);
on_inbound_conn(conn_interface);
}
else
{
log::critical(logcat, "Outbound connection fom {} (remote:{})", rid, remote);
log::critical(logcat, "Outbound connection from {} (remote:{})", rid, remote);
on_outbound_conn(conn_interface);
}
log::critical(
logcat,
"SERVICE NODE (RID:{}) ESTABLISHED CONNECTION TO RID:{}",
_router.local_rid(),
rid);
});
};
@ -623,15 +641,15 @@ namespace llarp
}
size_t
LinkManager::get_num_connected(bool clients_only) const
LinkManager::get_num_connected_routers() const
{
return ep.num_connected(clients_only);
return ep.num_router_conns();
}
size_t
LinkManager::get_num_connected_clients() const
{
return get_num_connected(true);
return ep.num_client_conns();
}
bool
@ -704,10 +722,6 @@ namespace llarp
if (rid == gossip_src or rid == last_sender)
continue;
// don't gossip RCs to clients
if (not conn->remote_is_relay)
continue;
send_control_message(
rid,
"gossip_rc"s,
@ -800,9 +814,7 @@ namespace llarp
oxenc::bt_dict_consumer btdc{m.body()};
if (btdc.skip_until("local"))
remote.emplace(btdc.consume_dict_data());
// btdc.required("local");
// remote = RemoteRC{btdc.consume_dict_data()};
quantity = btdc.require<size_t>("quantity");
}
catch (const std::exception& e)
@ -811,7 +823,7 @@ namespace llarp
m.respond(messages::ERROR_RESPONSE, true);
return;
}
if (remote)
{
auto is_snode = _router.is_service_node();
@ -834,7 +846,6 @@ namespace llarp
}
}
auto& src = node_db->get_known_rcs();
auto count = src.size();
@ -865,7 +876,7 @@ namespace llarp
}
}
m.respond(std::move(btdp).str());
m.respond(std::move(btdp).str(), count == 0);
}
void
@ -881,6 +892,7 @@ namespace llarp
void
LinkManager::handle_fetch_rcs(oxen::quic::message m)
{
log::critical(logcat, "Handling FetchRC request...");
// this handler should not be registered for clients
assert(_router.is_service_node());
@ -900,7 +912,7 @@ namespace llarp
}
catch (const std::exception& e)
{
log::info(link_cat, "Exception handling RC Fetch request: {}", e.what());
log::critical(link_cat, "Exception handling RC Fetch request: {}", e.what());
m.respond(messages::ERROR_RESPONSE, true);
return;
}
@ -908,7 +920,7 @@ namespace llarp
const auto& rcs = node_db->get_rcs();
oxenc::bt_dict_producer btdp;
const auto& last_time = node_db->get_last_rc_update_times();
// const auto& last_time = node_db->get_last_rc_update_times();
{
auto sublist = btdp.append_list("rcs");
@ -920,19 +932,24 @@ namespace llarp
// Initial fetch: give me all the RC's
if (explicit_ids.empty())
{
log::critical(logcat, "Returning ALL locally held RCs for initial FetchRC request...");
for (const auto& rc : rcs)
{
if (last_time.at(rc.router_id()) > since_time)
sublist.append_encoded(rc.view());
sublist.append_encoded(rc.view());
}
}
else
{
int count = 0;
for (const auto& rid : explicit_ids)
{
if (auto maybe_rc = node_db->get_rc_by_rid(rid))
{
sublist.append_encoded(maybe_rc->view());
++count;
}
}
log::critical(logcat, "Returning {} RCs for FetchRC request...", count);
}
}
@ -949,6 +966,8 @@ namespace llarp
void
LinkManager::handle_fetch_router_ids(oxen::quic::message m)
{
log::critical(logcat, "Handling FetchRIDs request...");
RouterID source;
RouterID local = router().local_rid();
@ -960,7 +979,9 @@ namespace llarp
}
catch (const std::exception& e)
{
log::info(link_cat, "Error fulfilling fetch RouterIDs request: {}", e.what());
log::critical(link_cat, "Error fulfilling FetchRIDs request: {}", e.what());
m.respond(messages::ERROR_RESPONSE, true);
return;
}
// if bad request, silently fail
@ -969,6 +990,7 @@ namespace llarp
if (source != local)
{
log::critical(logcat, "Relaying FetchRID request to intended target RID:{}", source);
send_control_message(
source,
"fetch_router_ids"s,
@ -999,6 +1021,7 @@ namespace llarp
return sig;
});
log::critical(logcat, "Returning ALL locally held RIDs to FetchRIDs request!");
m.respond(std::move(btdp).str());
}

@ -40,6 +40,9 @@ namespace llarp
inline const keep_alive ROUTER_KEEP_ALIVE{10s};
inline const keep_alive CLIENT_KEEP_ALIVE{10s};
inline constexpr int MIN_CLIENT_ROUTER_CONNS{4};
inline constexpr int MAX_CLIENT_ROUTER_CONNS{6};
namespace alpns
{
inline const auto SN_ALPNS = "SERVICE_NODE"_us;
@ -93,7 +96,10 @@ namespace llarp
num_in_out() const;
size_t
num_connected(bool clients_only) const;
num_client_conns() const;
size_t
num_router_conns() const;
template <typename... Opt>
bool
@ -198,12 +204,6 @@ namespace llarp
// holds any messages we attempt to send while connections are establishing
std::unordered_map<RouterID, MessageQueue> pending_conn_msg_queue;
// when establishing a connection, the rid of the remote is placed here to be cross-
// checked by the tls verification callback
std::map<RouterID, RemoteRC> rids_pending_verification;
// in the interim of verifying an outbound connection and the creation of its link::Connection
// object, we store the rid and rc here
std::map<RouterID, RemoteRC> verified_rids;
util::DecayingHashSet<RouterID> clients{path::DEFAULT_LIFETIME};
@ -327,7 +327,7 @@ namespace llarp
num_in_out() const;
size_t
get_num_connected(bool clients_only = false) const;
get_num_connected_routers() const;
size_t
get_num_connected_clients() const;
@ -434,9 +434,11 @@ namespace llarp
try
{
const auto& rid = rc.router_id();
log::critical(logcat, "Establishing connection to RID:{}", rid);
const auto& is_snode = _is_service_node;
bool is_snode = link_manager.is_service_node();
log::critical(logcat, "Establishing connection to RID:{}", rid);
// add to service conns
auto [itr, b] = service_conns.emplace(rid, nullptr);
auto conn_interface = endpoint->connect(
remote,
@ -444,9 +446,6 @@ namespace llarp
is_snode ? ROUTER_KEEP_ALIVE : CLIENT_KEEP_ALIVE,
std::forward<Opt>(opts)...);
// add to service conns
auto [itr, b] = service_conns.emplace(rid, nullptr);
auto control_stream = conn_interface->template open_stream<oxen::quic::BTRequestStream>(
[this, rid = rid](oxen::quic::Stream&, uint64_t error_code) {
log::warning(
@ -456,8 +455,6 @@ namespace llarp
close_connection(rid);
});
log::critical(logcat, "Opened BTStream (ID:{})", control_stream->stream_id());
assert(control_stream->stream_id() == 0);
if (is_snode)
link_manager.register_commands(control_stream, rid);
else

@ -65,13 +65,15 @@ namespace llarp
serialize(std::optional<LocalRC> local_rc, size_t quantity)
{
oxenc::bt_dict_producer btdp;
if (local_rc)
{
log::critical(logcat, "Serializing localRC: {}", oxenc::to_hex(local_rc->view()));
btdp.append_encoded("local", oxen::quic::to_sv(local_rc->view()));
log::critical(logcat, "Serializing localRC: {}", oxenc::to_hex(local_rc->view()));
}
btdp.append("quantity", quantity);
return std::move(btdp).str();
}

@ -336,6 +336,7 @@ namespace llarp
}
else
{
_fetching_initial = true;
// Set fetch source as random selection of known active client routers
fetch_source = *std::next(known_rids.begin(), csrng() % known_rids.size());
fetch_rcs(true);
@ -357,13 +358,27 @@ namespace llarp
std::vector<RouterID> needed;
const auto now = time_point_now();
for (const auto& [rid, rc] : rc_lookup)
if (not initial)
{
if (now - rc.timestamp() > RouterContact::OUTDATED_AGE)
needed.push_back(rid);
for (const auto& [rid, rc] : rc_lookup)
{
if (now - rc.timestamp() > RouterContact::OUTDATED_AGE)
needed.push_back(rid);
}
}
RouterID& src = fetch_source;
log::critical(
logcat,
"Sending{} FetchRCs request to {} for {} RCs",
initial ? " initial" : "",
src,
initial ? "all of the" : std::to_string(needed.size()));
if (initial)
_router.next_initial_fetch_attempt = now + INITIAL_ATTEMPT_INTERVAL;
_router.last_rc_fetch = now;
_router.link_manager().fetch_rcs(
src,
@ -371,7 +386,7 @@ namespace llarp
[this, src, initial](oxen::quic::message m) mutable {
if (m.timed_out)
{
log::info(logcat, "RC fetch to {} timed out!", src);
log::critical(logcat, "RC fetch to {} timed out!", src);
fetch_rcs_result(initial, m.timed_out);
return;
}
@ -382,7 +397,7 @@ namespace llarp
if (m.is_error())
{
auto reason = btdc.require<std::string_view>(messages::STATUS_KEY);
log::info(logcat, "RC fetch to {} returned error: {}", src, reason);
log::critical(logcat, "RC fetch to {} returned error: {}", src, reason);
fetch_rcs_result(initial, m.is_error());
return;
}
@ -399,7 +414,7 @@ namespace llarp
}
catch (const std::exception& e)
{
log::info(logcat, "Failed to parse RC fetch response from {}: {}", src, e.what());
log::critical(logcat, "Failed to parse RC fetch response from {}: {}", src, e.what());
fetch_rcs_result(initial, true);
return;
}
@ -431,9 +446,11 @@ namespace llarp
fetch_counters.clear();
RouterID& src = fetch_source;
_router.last_rid_fetch = llarp::time_point_now();
for (const auto& target : rid_sources)
{
log::critical(logcat, "Sending FetchRIDs request to {} via {}", target, src);
_router.link_manager().fetch_router_ids(
src,
FetchRIDMessage::serialize(target),
@ -442,7 +459,7 @@ namespace llarp
{
auto err = "RID fetch from {} via {} {}"_format(
src, target, m.timed_out ? "timed out" : "failed");
log::info(link_cat, err);
log::critical(link_cat, err);
ingest_rid_fetch_responses(target);
fetch_rids_result(initial);
return;
@ -469,7 +486,7 @@ namespace llarp
{
if (s.size() != RouterID::SIZE)
{
log::warning(
log::critical(
link_cat, "RID fetch from {} via {} returned bad RouterID", target, src);
ingest_rid_fetch_responses(target);
fetch_rids_result(initial);
@ -485,7 +502,7 @@ namespace llarp
}
catch (const std::exception& e)
{
log::info(link_cat, "Error handling fetch RouterIDs response: {}", e.what());
log::critical(link_cat, "Error handling fetch RouterIDs response: {}", e.what());
ingest_rid_fetch_responses(target);
fetch_rids_result(initial);
}
@ -500,7 +517,7 @@ namespace llarp
{
if (++fetch_failures >= MAX_FETCH_ATTEMPTS)
{
log::info(
log::critical(
logcat,
"RC fetching from {} reached failure threshold ({}); falling back to bootstrap...",
fetch_source,
@ -510,6 +527,9 @@ namespace llarp
return;
}
if (initial)
_needs_initial_fetch = true;
// If we have passed the last last conditional, then it means we are not bootstrapping
// and the current fetch_source has more attempts before being rotated. As a result, we
// find new non-bootstrap RC fetch source and try again buddy
@ -520,7 +540,7 @@ namespace llarp
}
else
{
log::debug(logcat, "Successfully fetched RC's from {}", fetch_source);
log::critical(logcat, "Successfully fetched RC's from {}", fetch_source);
post_fetch_rcs(initial);
}
}
@ -530,7 +550,7 @@ namespace llarp
{
if (fetch_failures >= MAX_FETCH_ATTEMPTS)
{
log::info(
log::critical(
logcat,
"Failed {} attempts to fetch RID's from {}; reverting to bootstrap...",
MAX_FETCH_ATTEMPTS,
@ -544,7 +564,7 @@ namespace llarp
if (n_responses < RID_SOURCE_COUNT)
{
log::debug(logcat, "Received {}/{} fetch RID requests", n_responses, RID_SOURCE_COUNT);
log::critical(logcat, "Received {}/{} fetch RID requests", n_responses, RID_SOURCE_COUNT);
return;
}
@ -552,18 +572,18 @@ namespace llarp
if (n_fails <= MAX_RID_ERRORS)
{
log::debug(
log::critical(
logcat, "RID fetching was successful ({}/{} acceptable errors)", n_fails, MAX_RID_ERRORS);
// this is where the trust model will do verification based on the similarity of the sets
if (process_fetched_rids())
{
log::debug(logcat, "Accumulated RID's accepted by trust model");
log::critical(logcat, "Accumulated RID's accepted by trust model");
post_fetch_rids(initial);
return;
}
log::debug(
log::critical(
logcat, "Accumulated RID's rejected by trust model, reselecting all RID sources...");
reselect_router_id_sources(rid_sources);
++fetch_failures;
@ -571,29 +591,24 @@ namespace llarp
else
{
// we had 4 or more failed requests, so we will need to rotate our rid sources
log::debug(
log::critical(
logcat, "RID fetching found {} failures; reselecting failed RID sources...", n_fails);
++fetch_failures;
reselect_router_id_sources(fail_sources);
}
fetch_rids(true);
fetch_rids(initial);
}
// This function is only called after a successful FetchRC request
void
NodeDB::post_fetch_rcs(bool initial)
{
_router.last_rc_fetch = llarp::time_point_now();
if (_router.is_service_node())
{
_needs_rebootstrap = false;
_needs_initial_fetch = false;
_using_bootstrap_fallback = false;
fail_sources.clear();
fetch_failures = 0;
return;
}
_needs_rebootstrap = false;
_needs_initial_fetch = false;
_using_bootstrap_fallback = false;
fail_sources.clear();
fetch_failures = 0;
if (initial)
fetch_rids(initial);
@ -604,7 +619,6 @@ namespace llarp
{
fail_sources.clear();
fetch_failures = 0;
_router.last_rid_fetch = llarp::time_point_now();
fetch_counters.clear();
_needs_rebootstrap = false;
_using_bootstrap_fallback = false;
@ -612,6 +626,7 @@ namespace llarp
if (initial)
{
_needs_initial_fetch = false;
_fetching_initial = false;
_initial_completed = true;
}
}
@ -655,16 +670,13 @@ namespace llarp
auto is_snode = _router.is_service_node();
auto num_needed = is_snode ? SERVICE_NODE_BOOTSTRAP_SOURCE_COUNT
: CLIENT_BOOTSTRAP_SOURCE_COUNT;
auto num_needed =
is_snode ? SERVICE_NODE_BOOTSTRAP_SOURCE_COUNT : CLIENT_BOOTSTRAP_SOURCE_COUNT;
_router.link_manager().fetch_bootstrap_rcs(
rc,
BootstrapFetchMessage::serialize(
is_snode ?
std::make_optional(_router.router_contact) :
std::nullopt,
num_needed),
is_snode ? std::make_optional(_router.router_contact) : std::nullopt, num_needed),
[this, is_snode = _router.is_service_node()](oxen::quic::message m) mutable {
log::critical(logcat, "Received response to BootstrapRC fetch request...");
@ -706,7 +718,6 @@ namespace llarp
bootstrap_attempts,
MAX_BOOTSTRAP_FETCH_ATTEMPTS,
e.what());
log::critical(logcat, "DEBUG FIXME THIS IS WHAT I GOT: {}", oxenc::to_hex(m.body()));
fallback_to_bootstrap();
return;
}
@ -853,8 +864,11 @@ namespace llarp
RemoteRC rc{};
if (not rc.read(f) or rc.is_expired(now))
{
// try loading it, purge it if it is junk or expired
purge.push_back(f);
continue;
}
const auto& rid = rc.router_id();

@ -176,7 +176,7 @@ namespace llarp
std::atomic<int> fetch_failures{0}, bootstrap_attempts{0};
std::atomic<bool> _using_bootstrap_fallback{false}, _needs_rebootstrap{false},
_needs_initial_fetch{true}, _initial_completed{false};
_needs_initial_fetch{true}, _fetching_initial{false}, _initial_completed{false};
bool
want_rc(const RouterID& rid) const;
@ -211,6 +211,18 @@ namespace llarp
std::optional<RemoteRC>
get_rc_by_rid(const RouterID& rid);
bool
is_initial_fetching() const
{
return _fetching_initial;
}
bool
initial_fetch_completed() const
{
return _initial_completed;
}
bool
needs_initial_fetch() const
{

@ -391,6 +391,9 @@ namespace llarp
else
llarp::logRingBuffer = nullptr;
// TESTNET:
oxen::log::set_level("quic", oxen::log::Level::critical);
log::debug(logcat, "Configuring router");
_is_service_node = conf.router.is_relay;
@ -417,9 +420,7 @@ namespace llarp
logcat, _is_service_node ? "Running as a relay (service node)" : "Running as a client");
if (_is_service_node)
{
_rpc_client->ConnectAsync(rpc_addr);
}
log::debug(logcat, "Initializing key manager");
if (not _key_manager->initialize(conf, true, isSNode))
@ -522,7 +523,7 @@ namespace llarp
size_t
Router::num_router_connections() const
{
return _link_manager->get_num_connected();
return _link_manager->get_num_connected_routers();
}
size_t
@ -661,35 +662,28 @@ namespace llarp
{
const auto now = llarp::time_now_ms();
if (is_service_node())
{
auto [in, out] = _link_manager->num_in_out();
log::critical(
logcat,
"Local Service Node has {} RCs, {} RIDs, {} bootstrap peers, {}:{} (inbound:outbound) "
"router "
"connections, and {} client connections since last RC update ({} to expiry)",
_node_db->num_rcs(),
_node_db->num_rids(),
_node_db->num_bootstraps(),
in,
out,
num_client_connections(),
router_contact.time_to_expiry(now));
if (num_router_connections() >= _node_db->num_rcs())
log::critical(logcat, "SERVICE NODE IS FULLY MESHED");
}
else
auto [in, out] = _link_manager->num_in_out();
auto num_bootstraps = _node_db->num_bootstraps();
auto num_rids = _node_db->num_rids();
auto num_rcs = _node_db->num_rcs();
auto num_router_conns = num_router_connections();
log::critical(
logcat,
"Local {} has {} RCs, {} RIDs, {} bootstrap peers, {}:{} (inbound:outbound) "
"conns ({} router, {} client)",
is_service_node() ? "Service Node" : "Client",
num_rcs,
num_rids,
num_bootstraps,
in,
out,
num_router_conns,
num_client_connections());
if (is_service_node() and num_router_connections() >= num_rcs)
{
log::critical(
logcat,
"{} RCs loaded with {} RIDs, {} bootstrap peers, and {} router connections!",
_node_db->num_rcs(),
_node_db->num_rids(),
_node_db->num_bootstraps(),
num_router_connections());
log::critical(logcat, "SERVICE NODE IS FULLY MESHED");
}
if (_last_stats_report > 0s)
@ -758,6 +752,16 @@ namespace llarp
const bool is_snode = is_service_node();
const bool is_decommed = appears_decommed();
const auto& local = local_rid();
if (is_snode and not node_db()->registered_routers().count(local))
{
log::critical(logcat, "We are NOT registered router, figure it out!");
// update tick timestamp
_last_tick = llarp::time_now_ms();
return;
}
const auto now = llarp::time_now_ms();
auto now_timepoint = std::chrono::system_clock::time_point(now);
@ -801,20 +805,18 @@ namespace llarp
next_rc_gossip = now_timepoint + TESTNET_GOSSIP_INTERVAL - delta;
}
// report_stats();
}
if (needs_rebootstrap() and now_timepoint > next_bootstrap_attempt)
{
node_db()->fallback_to_bootstrap();
}
else if (needs_initial_fetch())
else if (needs_initial_fetch() and now_timepoint > next_initial_fetch_attempt)
{
if (not _config->bootstrap.seednode)
node_db()->fetch_initial(is_service_node());
}
else if (not is_snode)
else if (not is_snode and node_db()->initial_fetch_completed())
{
// (client-only) periodically fetch updated RCs
if (now_timepoint - last_rc_fetch > RC_UPDATE_INTERVAL)
@ -884,9 +886,8 @@ namespace llarp
_link_manager->check_persisting_conns(now);
auto num_conns = num_router_connections();
const auto& num_rcs = node_db()->num_rcs();
auto num_router_conns = num_router_connections();
auto num_rcs = node_db()->num_rcs();
if (is_snode)
{
@ -914,7 +915,7 @@ namespace llarp
}
}
if (num_conns < num_rcs)
if (num_router_conns < num_rcs)
{
log::critical(
logcat,
@ -925,7 +926,7 @@ namespace llarp
}
else
{
size_t min_client_conns = _link_manager->client_router_connections;
size_t min_client_conns = MIN_CLIENT_ROUTER_CONNS;
const auto& pinned_edges = _node_db->pinned_edges();
const auto pinned_count = pinned_edges.size();
@ -934,16 +935,18 @@ namespace llarp
// if we need more sessions to routers and we are not a service node kicked from the network
// or we are a client we shall connect out to others
if (num_conns < min_client_conns)
if (num_router_conns < min_client_conns)
{
size_t needed = min_client_conns - num_conns;
size_t needed = min_client_conns - num_router_conns;
log::critical(logcat, "Client connecting to {} random routers to keep alive", needed);
_link_manager->connect_to_random(needed);
}
else
{
_hidden_service_context.Tick(now);
_exit_context.Tick(now);
// log::critical(
// logcat, "Client skipping hidden service exit tick or whatever the fuck that means");
// _hidden_service_context.Tick(now);
// _exit_context.Tick(now);
}
}

@ -50,7 +50,8 @@ namespace llarp
// TESTNET: these constants are shortened for testing purposes
inline constexpr std::chrono::milliseconds TESTNET_GOSSIP_INTERVAL{10min};
inline constexpr std::chrono::milliseconds RC_UPDATE_INTERVAL{4min};
inline constexpr std::chrono::milliseconds RC_UPDATE_INTERVAL{5min};
inline constexpr std::chrono::milliseconds INITIAL_ATTEMPT_INTERVAL{30s};
// as we advance towards full mesh, we try to connect to this number per tick
inline constexpr int FULL_MESH_ITERATION{1};
inline constexpr std::chrono::milliseconds ROUTERID_UPDATE_INTERVAL{1h};
@ -159,11 +160,10 @@ namespace llarp
insufficient_peers() const;
protected:
// bool _needs_initial_fetch{true};
std::chrono::system_clock::time_point last_rc_gossip{
std::chrono::system_clock::time_point::min()};
std::chrono::system_clock::time_point next_rc_gossip{last_rc_gossip};
std::chrono::system_clock::time_point next_initial_fetch_attempt{last_rc_gossip};
std::chrono::system_clock::time_point last_rc_fetch{last_rc_gossip};
std::chrono::system_clock::time_point last_rid_fetch{last_rc_gossip};
std::chrono::system_clock::time_point next_bootstrap_attempt{last_rc_gossip};

Loading…
Cancel
Save