This commit is contained in:
John Smith
2022-09-09 16:27:13 -04:00
parent b13f8947df
commit 72b03939ef
10 changed files with 99 additions and 51 deletions

View File

@@ -1425,14 +1425,13 @@ impl NetworkManager {
};
// Send boot magic to requested peer address
let data = BOOT_MAGIC.to_vec();
let out_data: Vec<u8> = match self
let out_data: Vec<u8> = network_result_value_or_log!(debug self
.net()
.send_recv_data_unbound_to_dial_info(dial_info, data, timeout_ms)
.await?
.await? =>
{
NetworkResult::Value(v) => v,
_ => return Ok(Vec::new()),
};
return Ok(Vec::new());
});
let bootstrap_peerinfo: Vec<PeerInfo> =
deserialize_json(std::str::from_utf8(&out_data).wrap_err("bad utf8 in boot peerinfo")?)

View File

@@ -181,8 +181,12 @@ impl NetworkManager {
let routing_table = self.routing_table();
for bootstrap_di in bootstrap_dialinfos {
log_net!(debug "direct bootstrap with: {}", bootstrap_di);
let peer_info = self.boot_request(bootstrap_di).await?;
log_net!(debug " direct bootstrap peerinfo: {:?}", peer_info);
// Got peer info, let's add it to the routing table
for pi in peer_info {
let k = pi.node_id.key;

View File

@@ -741,6 +741,8 @@ impl RoutingTable {
signed_node_info: SignedNodeInfo,
allow_invalid: bool,
) -> Option<NodeRef> {
log_rtab!("register_node_with_signed_node_info: routing_domain: {:?}, node_id: {:?}, signed_node_info: {:?}, allow_invalid: {:?}", routing_domain, node_id, signed_node_info, allow_invalid );
// validate signed node info is not something malicious
if node_id == self.node_id() {
log_rtab!(debug "can't register own node id in routing table");

View File

@@ -853,9 +853,13 @@ impl fmt::Debug for DialInfoFilter {
let mut out = String::new();
if self.protocol_type_set != ProtocolTypeSet::all() {
out += &format!("+{:?}", self.protocol_type_set);
} else {
out += "*";
}
if self.address_type_set != AddressTypeSet::all() {
out += &format!("+{:?}", self.address_type_set);
} else {
out += "*";
}
write!(f, "[{}]", out)
}