minor fixups

pull/2225/head
Thomas Winget 6 months ago
parent dab1e06892
commit 70d2052cd4

@ -447,18 +447,18 @@ namespace llarp
log::info(link_cat, "RC Fetch to {} timed out", source);
return;
}
if (not m)
{
log::info(link_cat, "RC Fetch to {} returned error.", source);
return;
}
try
{
oxenc::bt_dict_consumer btdc{m.body()};
btdc.required("rcs");
auto btlc = btdc.consume_list_consumer();
auto timestamp = rc_time{std::chrono::seconds{btdc.require<int64_t>("time")}};
if (not m)
{
auto reason = btdc.require<std::string_view>(messages::STATUS_KEY);
log::info(link_cat, "RC Fetch to {} returned error: {}", source, reason);
return;
}
auto btlc = btdc.require<oxenc::bt_list_consumer>("rcs"sv);
auto timestamp = rc_time{std::chrono::seconds{btdc.require<int64_t>("time"sv)}};
std::vector<RemoteRC> rcs;
while (not btlc.is_finished())
@ -473,7 +473,7 @@ namespace llarp
catch (const std::exception& e)
{
// TODO: Inform NodeDB of failure (perhaps just a call to rotate_rc_source())
log::info(link_cat, "Failed to parse RC Fetch response from {}", source);
log::info(link_cat, "Failed to parse RC Fetch response from {}: {}", source, e.what());
return;
}
});
@ -518,7 +518,7 @@ namespace llarp
oxenc::bt_dict_producer resp;
{
auto btlp = resp.append_list("rcs");
auto rc_bt_list = resp.append_list("rcs");
const auto& last_time = node_db->get_last_rc_update_times();
@ -529,7 +529,7 @@ namespace llarp
for (const auto& [_, rc] : rcs)
{
if (last_time.at(rc.router_id()) > since_time or explicit_relays.count(rc.router_id()))
btlp.append_encoded(rc.view());
rc_bt_list.append_encoded(rc.view());
}
}

@ -14,9 +14,11 @@ namespace llarp::RCFetchMessage
try
{
btdp.append("since", since.time_since_epoch() / 1s);
auto id_list = btdp.append_list("explicit_ids");
for (const auto& rid : explicit_ids)
id_list.append(rid.ToView());
{
auto id_list = btdp.append_list("explicit_ids");
for (const auto& rid : explicit_ids)
id_list.append(rid.ToView());
}
}
catch (...)
{

@ -203,7 +203,7 @@ namespace llarp
if (router_id_fetch_in_progress)
return;
if (router_id_fetch_sources.empty())
select_router_id_sources({});
select_router_id_sources();
// if we *still* don't have fetch sources, we can't exactly fetch...
if (router_id_fetch_sources.empty())

@ -130,7 +130,7 @@ namespace llarp
fetch_router_ids();
void
select_router_id_sources(std::unordered_set<RouterID> excluded);
select_router_id_sources(std::unordered_set<RouterID> excluded = {});
void
set_router_whitelist(

Loading…
Cancel
Save