(client) periodically fetch RouterIDs from peers

pull/2225/head
Thomas Winget 6 months ago
parent b353fd4095
commit 14b9aa20ee

@ -181,7 +181,7 @@ namespace llarp
}
void
NodeDB::update_rcs()
NodeDB::fetch_rcs()
{
std::vector<RouterID> needed;

@ -124,7 +124,7 @@ namespace llarp
ingest_router_ids(RouterID source, std::vector<RouterID> ids);
void
update_rcs();
fetch_rcs();
void
fetch_router_ids();

@ -835,11 +835,21 @@ namespace llarp
next_rc_gossip = now_timepoint + RouterContact::STALE_AGE - random_delta;
}
// (client-only) periodically fetch updated RCs
if (now_timepoint - last_rc_fetch > RC_UPDATE_INTERVAL)
if (not is_snode)
{
node_db()->update_rcs();
last_rc_fetch = now_timepoint;
// (client-only) periodically fetch updated RCs
if (now_timepoint - last_rc_fetch > RC_UPDATE_INTERVAL)
{
node_db()->fetch_rcs();
last_rc_fetch = now_timepoint;
}
// (client-only) periodically fetch updated RouterID list
if (now_timepoint - last_routerid_fetch > ROUTERID_UPDATE_INTERVAL)
{
node_db()->fetch_router_ids();
last_routerid_fetch = now_timepoint;
}
}
// remove RCs for nodes that are no longer allowed by network policy

@ -58,6 +58,7 @@ namespace llarp
(INTROSET_RELAY_REDUNDANCY * INTROSET_REQS_PER_RELAY);
static const std::chrono::seconds RC_UPDATE_INTERVAL = 5min;
static const std::chrono::seconds ROUTERID_UPDATE_INTERVAL = 1h;
struct Contacts;
@ -133,6 +134,8 @@ namespace llarp
std::chrono::system_clock::time_point last_rc_fetch{
std::chrono::system_clock::time_point::min()};
std::chrono::system_clock::time_point last_routerid_fetch{
std::chrono::system_clock::time_point::min()};
// should we be sending padded messages every interval?
bool send_padding = false;

Loading…
Cancel
Save