fix bugs and lints

This commit is contained in:
John Smith 2022-04-25 11:29:02 -04:00
parent 2d7cffee3d
commit 911d0c563f
9 changed files with 307 additions and 279 deletions

View File

@ -487,11 +487,11 @@ impl Network {
//////////////////////////////////////////
pub fn get_network_class(&self) -> Option<NetworkClass> {
let inner = self.inner.lock();
return inner.network_class;
inner.network_class
}
pub fn reset_network_class(&self) {
let inner = self.inner.lock();
let mut inner = self.inner.lock();
inner.network_class = None;
}

View File

@ -16,7 +16,7 @@ struct DiscoveryContextInner {
node_b: Option<NodeRef>,
}
struct DiscoveryContext {
pub struct DiscoveryContext {
routing_table: RoutingTable,
net: Network,
inner: Arc<Mutex<DiscoveryContextInner>>,
@ -43,10 +43,10 @@ impl DiscoveryContext {
///////
// Utilities
xxxx continue converting to async safe inner
// Pick the best network class we have seen so far
pub fn upgrade_network_class(&self, network_class: NetworkClass) {
let inner = self.inner.lock();
let mut inner = self.inner.lock();
if let Some(old_nc) = inner.network_class {
if network_class < old_nc {
@ -137,7 +137,7 @@ xxxx continue converting to async safe inner
.unwrap_or(false)
}
async fn try_port_mapping(&mut self) -> Option<DialInfo> {
async fn try_port_mapping(&self) -> Option<DialInfo> {
//xxx
None
}
@ -161,25 +161,30 @@ xxxx continue converting to async safe inner
///////
// Per-protocol discovery routines
pub fn protocol_begin(&mut self, protocol_type: ProtocolType, address_type: AddressType) {
pub fn protocol_begin(&self, protocol_type: ProtocolType, address_type: AddressType) {
// Get our interface addresses
self.intf_addrs = Some(self.get_local_addresses(protocol_type, address_type));
self.protocol_type = Some(protocol_type);
self.address_type = Some(address_type);
self.low_level_protocol_type = Some(match protocol_type {
let intf_addrs = self.get_local_addresses(protocol_type, address_type);
let mut inner = self.inner.lock();
inner.intf_addrs = Some(intf_addrs);
inner.protocol_type = Some(protocol_type);
inner.address_type = Some(address_type);
inner.low_level_protocol_type = Some(match protocol_type {
ProtocolType::UDP => ProtocolType::UDP,
ProtocolType::TCP => ProtocolType::TCP,
ProtocolType::WS => ProtocolType::TCP,
ProtocolType::WSS => ProtocolType::TCP,
});
self.external1_dial_info = None;
self.external1 = None;
self.node_b = None;
inner.external1_dial_info = None;
inner.external1 = None;
inner.node_b = None;
}
pub async fn protocol_get_external_address_1(&mut self) -> bool {
let protocol_type = self.protocol_type.unwrap();
let address_type = self.address_type.unwrap();
pub async fn protocol_get_external_address_1(&self) -> bool {
let (protocol_type, address_type) = {
let inner = self.inner.lock();
(inner.protocol_type.unwrap(), inner.address_type.unwrap())
};
// Get our external address from some fast node, call it node B
let (external1, node_b) = match self
@ -194,20 +199,22 @@ xxxx continue converting to async safe inner
};
let external1_dial_info = self.make_dial_info(external1, protocol_type);
self.external1_dial_info = Some(external1_dial_info);
self.external1 = Some(external1);
self.node_b = Some(node_b);
let mut inner = self.inner.lock();
inner.external1_dial_info = Some(external1_dial_info);
inner.external1 = Some(external1);
inner.node_b = Some(node_b);
true
}
pub async fn protocol_process_no_nat(&mut self) {
let node_b = self.node_b.as_ref().unwrap().clone();
let external1_dial_info = self.external1_dial_info.as_ref().unwrap().clone();
let external1 = self.external1.unwrap();
let protocol_type = self.protocol_type.unwrap();
let address_type = self.address_type.unwrap();
let intf_addrs = self.intf_addrs.as_ref().unwrap();
pub async fn protocol_process_no_nat(&self) {
let (node_b, external1_dial_info) = {
let inner = self.inner.lock();
(
inner.node_b.as_ref().unwrap().clone(),
inner.external1_dial_info.as_ref().unwrap().clone(),
)
};
// Do a validate_dial_info on the external address from a redirected node
if self
@ -240,13 +247,17 @@ xxxx continue converting to async safe inner
self.upgrade_network_class(NetworkClass::InboundCapable);
}
pub async fn protocol_process_nat(&mut self) -> bool {
let node_b = self.node_b.as_ref().unwrap().clone();
let external1_dial_info = self.external1_dial_info.as_ref().unwrap().clone();
let external1 = self.external1.unwrap();
let protocol_type = self.protocol_type.unwrap();
let address_type = self.address_type.unwrap();
let intf_addrs = self.intf_addrs.as_ref().unwrap();
pub async fn protocol_process_nat(&self) -> bool {
let (node_b, external1_dial_info, external1, protocol_type, address_type) = {
let inner = self.inner.lock();
(
inner.node_b.as_ref().unwrap().clone(),
inner.external1_dial_info.as_ref().unwrap().clone(),
inner.external1.unwrap(),
inner.protocol_type.unwrap(),
inner.address_type.unwrap(),
)
};
// Attempt a UDP port mapping via all available and enabled mechanisms
if let Some(external_mapped_dial_info) = self.try_port_mapping().await {
@ -337,7 +348,7 @@ xxxx continue converting to async safe inner
impl Network {
pub async fn update_ipv4_protocol_dialinfo(
&self,
context: &mut DiscoveryContext,
context: &DiscoveryContext,
protocol_type: ProtocolType,
) -> Result<(), String> {
let mut retry_count = {
@ -357,18 +368,23 @@ impl Network {
}
// If our local interface list contains external1 then there is no NAT in place
if context
{
let res = {
let inner = context.inner.lock();
inner
.intf_addrs
.as_ref()
.unwrap()
.contains(&context.external1.as_ref().unwrap())
{
.contains(inner.external1.as_ref().unwrap())
};
if res {
// No NAT
context.protocol_process_no_nat().await;
// No more retries
break;
}
}
// There is -some NAT-
if context.protocol_process_nat().await {
@ -388,7 +404,7 @@ impl Network {
pub async fn update_ipv6_protocol_dialinfo(
&self,
context: &mut DiscoveryContext,
context: &DiscoveryContext,
protocol_type: ProtocolType,
) -> Result<(), String> {
// Start doing ipv6 protocol
@ -401,19 +417,22 @@ impl Network {
}
// If our local interface list doesn't contain external1 then there is an Ipv6 NAT in place
if !context
{
let inner = context.inner.lock();
if !inner
.intf_addrs
.as_ref()
.unwrap()
.contains(&context.external1.as_ref().unwrap())
.contains(inner.external1.as_ref().unwrap())
{
// IPv6 NAT is not supported today
log_net!(warn
"IPv6 NAT is not supported for external address: {}",
context.external1.unwrap()
inner.external1.unwrap()
);
return Ok(());
}
}
// No NAT
context.protocol_process_no_nat().await;
@ -424,37 +443,32 @@ impl Network {
pub async fn update_network_class_task_routine(self, _l: u64, _t: u64) -> Result<(), String> {
log_net!("updating network class");
let protocol_config = self
.inner
.lock()
.protocol_config
.clone()
.unwrap_or_default();
let protocol_config = self.inner.lock().protocol_config.unwrap_or_default();
let context = DiscoveryContext::new(self.routing_table(), self.clone());
if protocol_config.inbound.contains(ProtocolType::UDP) {
self.update_ipv4_protocol_dialinfo(&mut context, ProtocolType::UDP)
self.update_ipv4_protocol_dialinfo(&context, ProtocolType::UDP)
.await?;
self.update_ipv6_protocol_dialinfo(&mut context, ProtocolType::UDP)
self.update_ipv6_protocol_dialinfo(&context, ProtocolType::UDP)
.await?;
}
if protocol_config.inbound.contains(ProtocolType::TCP) {
self.update_ipv4_protocol_dialinfo(&mut context, ProtocolType::TCP)
self.update_ipv4_protocol_dialinfo(&context, ProtocolType::TCP)
.await?;
self.update_ipv6_protocol_dialinfo(&mut context, ProtocolType::TCP)
self.update_ipv6_protocol_dialinfo(&context, ProtocolType::TCP)
.await?;
}
if protocol_config.inbound.contains(ProtocolType::WS) {
self.update_ipv4_protocol_dialinfo(&mut context, ProtocolType::WS)
self.update_ipv4_protocol_dialinfo(&context, ProtocolType::WS)
.await?;
self.update_ipv6_protocol_dialinfo(&mut context, ProtocolType::WS)
self.update_ipv6_protocol_dialinfo(&context, ProtocolType::WS)
.await?;
}
self.inner.lock().network_class = context.network_class;
self.inner.lock().network_class = context.inner.lock().network_class;
Ok(())
}

View File

@ -331,17 +331,16 @@ impl Network {
DialInfoClass::Direct,
);
// See if this public address is also a local interface address
if !local_dial_info_list.contains(&pdi)
&& self.with_interface_addresses(|ip_addrs| {
// See if this public address is also a local interface address we haven't registered yet
let is_interface_address = self.with_interface_addresses(|ip_addrs| {
for ip_addr in ip_addrs {
if pdi_addr.ip() == *ip_addr {
return true;
}
}
false
})
{
});
if !local_dial_info_list.contains(&pdi) && is_interface_address {
routing_table.register_dial_info(
RoutingDomain::LocalNetwork,
DialInfo::udp_from_socketaddr(pdi_addr),
@ -432,16 +431,15 @@ impl Network {
static_public = true;
// See if this public address is also a local interface address
if !registered_addresses.contains(&gsa.ip())
&& self.with_interface_addresses(|ip_addrs| {
let is_interface_address = self.with_interface_addresses(|ip_addrs| {
for ip_addr in ip_addrs {
if gsa.ip() == *ip_addr {
return true;
}
}
false
})
{
});
if !registered_addresses.contains(&gsa.ip()) && is_interface_address {
routing_table.register_dial_info(
RoutingDomain::LocalNetwork,
pdi,
@ -496,12 +494,11 @@ impl Network {
trace!("starting wss listeners");
let routing_table = self.routing_table();
let (listen_address, url, enable_local_peer_scope) = {
let (listen_address, url) = {
let c = self.config.get();
(
c.network.protocol.wss.listen_address.clone(),
c.network.protocol.wss.url.clone(),
c.network.enable_local_peer_scope,
)
};
@ -566,16 +563,15 @@ impl Network {
static_public = true;
// See if this public address is also a local interface address
if !registered_addresses.contains(&gsa.ip())
&& self.with_interface_addresses(|ip_addrs| {
let is_interface_address = self.with_interface_addresses(|ip_addrs| {
for ip_addr in ip_addrs {
if gsa.ip() == *ip_addr {
return true;
}
}
false
})
{
});
if !registered_addresses.contains(&gsa.ip()) && is_interface_address {
routing_table.register_dial_info(
RoutingDomain::LocalNetwork,
pdi,
@ -683,22 +679,21 @@ impl Network {
static_public = true;
// See if this public address is also a local interface address
if self.with_interface_addresses(|ip_addrs| {
let is_interface_address = self.with_interface_addresses(|ip_addrs| {
for ip_addr in ip_addrs {
if pdi_addr.ip() == *ip_addr {
return true;
}
}
false
}) {
});
if is_interface_address {
routing_table.register_dial_info(
RoutingDomain::LocalNetwork,
pdi,
DialInfoClass::Direct,
);
}
static_public = true;
}
}

View File

@ -599,7 +599,7 @@ impl NetworkManager {
if envelope_node_id != via_node_id {
return Ok(SendDataKind::GlobalIndirect);
}
return Ok(send_data_kind);
Ok(send_data_kind)
}
// Called by the RPC handler when we want to issue an direct receipt
@ -626,7 +626,7 @@ impl NetworkManager {
}
// Figure out how to reach a node
fn get_contact_method(&self, target_node_ref: NodeRef) -> Result<ContactMethod, String> {
fn get_contact_method(&self, mut target_node_ref: NodeRef) -> Result<ContactMethod, String> {
let routing_table = self.routing_table();
// Get our network class and protocol config
@ -639,22 +639,22 @@ impl NetworkManager {
}
// Get the best matching local direct dial info if we have it
let opt_local_did =
let opt_target_local_did =
target_node_ref.first_filtered_dial_info_detail(Some(RoutingDomain::LocalNetwork));
if let Some(local_did) = opt_local_did {
return Ok(ContactMethod::Direct(local_did.dial_info));
if let Some(target_local_did) = opt_target_local_did {
return Ok(ContactMethod::Direct(target_local_did.dial_info));
}
// Get the best match internet dial info if we have it
let opt_public_did =
let opt_target_public_did =
target_node_ref.first_filtered_dial_info_detail(Some(RoutingDomain::PublicInternet));
// Can the target node do inbound?
let target_network_class = target_node_ref.network_class();
//if matches!(target_network_class, NetworkClass::InboundCapable) {
if let Some(public_did) = opt_public_did {
if let Some(target_public_did) = opt_target_public_did {
// Do we need to signal before going inbound?
if public_did.class.requires_signal() {
if !target_public_did.class.requires_signal() {
// Go direct without signaling
return Ok(ContactMethod::Direct(target_public_did.dial_info));
}
// Get the target's inbound relay, it must have one or it is not reachable
if let Some(inbound_relay_nr) = target_node_ref.relay() {
// Can we reach the inbound relay?
@ -667,12 +667,10 @@ impl NetworkManager {
// Get the best match dial info for an reverse inbound connection
let reverse_dif = DialInfoFilter::global()
.with_protocol_set(target_node_ref.outbound_protocols());
if let Some(reverse_did) = routing_table
.first_filtered_dial_info_detail(
RoutingDomain::PublicInternet,
if let Some(reverse_did) = routing_table.first_filtered_dial_info_detail(
Some(RoutingDomain::PublicInternet),
&reverse_dif,
)
{
) {
// Can we receive a direct reverse connection?
if !reverse_did.class.requires_signal() {
return Ok(ContactMethod::SignalReverse(
@ -691,9 +689,8 @@ impl NetworkManager {
// Do the target and self nodes have a direct udp dialinfo
let udp_dif =
DialInfoFilter::global().with_protocol_type(ProtocolType::UDP);
let udp_target_nr = target_node_ref.clone();
udp_target_nr
.filter_protocols(ProtocolSet::only(ProtocolType::UDP));
let mut udp_target_nr = target_node_ref.clone();
udp_target_nr.filter_protocols(ProtocolSet::only(ProtocolType::UDP));
let target_has_udp_dialinfo = target_node_ref
.first_filtered_dial_info_detail(Some(
RoutingDomain::PublicInternet,
@ -701,7 +698,7 @@ impl NetworkManager {
.is_some();
let self_has_udp_dialinfo = routing_table
.first_filtered_dial_info_detail(
RoutingDomain::PublicInternet,
Some(RoutingDomain::PublicInternet),
&udp_dif,
)
.is_some();
@ -719,16 +716,8 @@ impl NetworkManager {
}
}
}
// Go direct without signaling
else {
// If we have direct dial info we can use, do it
if let Some(did) = opt_public_did {
return Ok(ContactMethod::Direct(did.dial_info));
}
}
} else {
// If the other node is not inbound capable at all, it is using a full relay
if let Some(target_inbound_relay_nr) = target_node_ref.relay() {
else if let Some(target_inbound_relay_nr) = target_node_ref.relay() {
// Can we reach the full relay?
if target_inbound_relay_nr
.first_filtered_dial_info_detail(Some(RoutingDomain::PublicInternet))
@ -737,7 +726,7 @@ impl NetworkManager {
return Ok(ContactMethod::InboundRelay(target_inbound_relay_nr));
}
}
}
// If we can't reach the node by other means, try our outbound relay if we have one
if let Some(relay_node) = self.relay_node() {
return Ok(ContactMethod::OutboundRelay(relay_node));
@ -868,23 +857,17 @@ impl NetworkManager {
let inbound_nr = match eventual_value.await {
ReceiptEvent::Returned(inbound_nr) => inbound_nr,
ReceiptEvent::Expired => {
return Err(format!(
"reverse connect receipt expired from {:?}",
target_nr
));
return Err(format!("hole punch receipt expired from {:?}", target_nr));
}
ReceiptEvent::Cancelled => {
return Err(format!(
"reverse connect receipt cancelled from {:?}",
target_nr
));
return Err(format!("hole punch receipt cancelled from {:?}", target_nr));
}
};
// We expect the inbound noderef to be the same as the target noderef
// if they aren't the same, we should error on this and figure out what then hell is up
if target_nr != inbound_nr {
error!("unexpected noderef mismatch on reverse connect");
error!("unexpected noderef mismatch on hole punch");
}
// And now use the existing connection to send over
@ -896,10 +879,10 @@ impl NetworkManager {
.map_err(logthru_net!())?
{
None => Ok(()),
Some(_) => Err("unable to send over reverse connection".to_owned()),
Some(_) => Err("unable to send over hole punch".to_owned()),
}
} else {
Err("no reverse connection available".to_owned())
Err("no hole punch available".to_owned())
}
}
@ -947,17 +930,17 @@ impl NetworkManager {
.await
.map(|_| SendDataKind::GlobalIndirect)
}
ContactMethod::Direct(dial_info) => this
.net()
.send_data_to_dial_info(dial_info, data)
.await
.map(|_| {
if dial_info.is_local() {
ContactMethod::Direct(dial_info) => {
let send_data_kind = if dial_info.is_local() {
SendDataKind::LocalDirect
} else {
SendDataKind::GlobalDirect
};
this.net()
.send_data_to_dial_info(dial_info, data)
.await
.map(|_| send_data_kind)
}
}),
ContactMethod::SignalReverse(relay_nr, target_node_ref) => this
.do_reverse_connect(relay_nr, target_node_ref, data)
.await

View File

@ -50,7 +50,6 @@ impl RoutingTable {
// Get our own node's peer info (public node info) so we can share it with other nodes
pub fn get_own_peer_info(&self) -> PeerInfo {
let netman = self.network_manager();
let enable_local_peer_scope = netman.config().get().network.enable_local_peer_scope;
let relay_node = netman.relay_node();
PeerInfo {
node_id: NodeId::new(self.node_id()),

View File

@ -187,18 +187,37 @@ impl RoutingTable {
pub fn first_filtered_dial_info_detail(
&self,
domain: RoutingDomain,
domain: Option<RoutingDomain>,
filter: &DialInfoFilter,
) -> Option<DialInfoDetail> {
let inner = self.inner.lock();
Self::with_routing_domain(&*inner, domain, |rd| {
for did in rd.dial_info_details {
// Prefer local network first if it isn't filtered out
if domain == None || domain == Some(RoutingDomain::LocalNetwork) {
Self::with_routing_domain(&*inner, RoutingDomain::LocalNetwork, |rd| {
for did in &rd.dial_info_details {
if did.matches_filter(filter) {
return Some(did.clone());
}
}
None
})
} else {
None
}
.or_else(|| {
if domain == None || domain == Some(RoutingDomain::PublicInternet) {
Self::with_routing_domain(&*inner, RoutingDomain::PublicInternet, |rd| {
for did in &rd.dial_info_details {
if did.matches_filter(filter) {
return Some(did.clone());
}
}
None
})
} else {
None
}
})
}
pub fn all_filtered_dial_info_details(
@ -211,7 +230,7 @@ impl RoutingTable {
if domain == None || domain == Some(RoutingDomain::LocalNetwork) {
Self::with_routing_domain(&*inner, RoutingDomain::LocalNetwork, |rd| {
for did in rd.dial_info_details {
for did in &rd.dial_info_details {
if did.matches_filter(filter) {
ret.push(did.clone());
}
@ -220,7 +239,7 @@ impl RoutingTable {
}
if domain == None || domain == Some(RoutingDomain::PublicInternet) {
Self::with_routing_domain(&*inner, RoutingDomain::PublicInternet, |rd| {
for did in rd.dial_info_details {
for did in &rd.dial_info_details {
if did.matches_filter(filter) {
ret.push(did.clone());
}

View File

@ -46,11 +46,12 @@ impl NodeRef {
// Returns true if some protocols can still pass the filter and false if no protocols remain
pub fn filter_protocols(&mut self, protocol_set: ProtocolSet) -> bool {
if protocol_set != ProtocolSet::all() {
let mut dif = self.filter.unwrap_or_default();
let mut dif = self.filter.clone().unwrap_or_default();
dif.protocol_set &= protocol_set;
self.filter = Some(dif);
}
self.filter
.as_ref()
.map(|f| !f.protocol_set.is_empty())
.unwrap_or(true)
}
@ -79,13 +80,12 @@ impl NodeRef {
self.operate(|e| e.node_info().outbound_protocols)
}
pub fn relay(&self) -> Option<NodeRef> {
let target_rpi = self.operate(|e| e.node_info().relay_peer_info)?;
let target_rpi = self.operate(|e| e.node_info().relay_peer_info.clone())?;
self.routing_table
.register_node_with_node_info(target_rpi.node_id.key, target_rpi.node_info)
.map_err(logthru_rtab!(error))
.ok()
.map(|nr| {
.map(|mut nr| {
nr.set_filter(self.filter_ref().cloned());
nr
})
@ -95,16 +95,20 @@ impl NodeRef {
routing_domain: Option<RoutingDomain>,
) -> Option<DialInfoDetail> {
self.operate(|e| {
// Prefer local dial info first unless it is filtered out
if (routing_domain == None || routing_domain == Some(RoutingDomain::LocalNetwork))
&& matches!(
self.filter.map(|f| f.peer_scope).unwrap_or(PeerScope::All),
self.filter
.as_ref()
.map(|f| f.peer_scope)
.unwrap_or(PeerScope::All),
PeerScope::All | PeerScope::Local
)
{
e.local_node_info()
.first_filtered_dial_info(|di| {
if let Some(filter) = self.filter {
di.matches_filter(&filter)
if let Some(filter) = self.filter.as_ref() {
di.matches_filter(filter)
} else {
true
}
@ -119,13 +123,16 @@ impl NodeRef {
.or_else(|| {
if (routing_domain == None || routing_domain == Some(RoutingDomain::PublicInternet))
&& matches!(
self.filter.map(|f| f.peer_scope).unwrap_or(PeerScope::All),
self.filter
.as_ref()
.map(|f| f.peer_scope)
.unwrap_or(PeerScope::All),
PeerScope::All | PeerScope::Global
)
{
e.node_info().first_filtered_dial_info_detail(|did| {
if let Some(filter) = self.filter {
did.matches_filter(&filter)
if let Some(filter) = self.filter.as_ref() {
did.matches_filter(filter)
} else {
true
}
@ -143,15 +150,19 @@ impl NodeRef {
) -> Vec<DialInfoDetail> {
let mut out = Vec::new();
self.operate(|e| {
// Prefer local dial info first unless it is filtered out
if (routing_domain == None || routing_domain == Some(RoutingDomain::LocalNetwork))
&& matches!(
self.filter.map(|f| f.peer_scope).unwrap_or(PeerScope::All),
self.filter
.as_ref()
.map(|f| f.peer_scope)
.unwrap_or(PeerScope::All),
PeerScope::All | PeerScope::Local
)
{
for di in e.local_node_info().all_filtered_dial_info(|di| {
if let Some(filter) = self.filter {
di.matches_filter(&filter)
if let Some(filter) = self.filter.as_ref() {
di.matches_filter(filter)
} else {
true
}
@ -164,13 +175,16 @@ impl NodeRef {
}
if (routing_domain == None || routing_domain == Some(RoutingDomain::PublicInternet))
&& matches!(
self.filter.map(|f| f.peer_scope).unwrap_or(PeerScope::All),
self.filter
.as_ref()
.map(|f| f.peer_scope)
.unwrap_or(PeerScope::All),
PeerScope::All | PeerScope::Global
)
{
out.append(&mut e.node_info().all_filtered_dial_info_details(|did| {
if let Some(filter) = self.filter {
did.matches_filter(&filter)
if let Some(filter) = self.filter.as_ref() {
did.matches_filter(filter)
} else {
true
}

View File

@ -1378,6 +1378,7 @@ impl RPCProcessor {
// Wait for reply
let (rpcreader, latency) = self.wait_for_reply(waitable_reply).await?;
let (sender_info, node_status) = {
let response_operation = rpcreader
.reader
.get_root::<veilid_capnp::operation::Reader>()
@ -1419,8 +1420,10 @@ impl RPCProcessor {
e.update_node_status(node_status.clone());
});
// Report sender_info IP addresses to network manager
(sender_info, node_status)
};
// Report sender_info IP addresses to network manager
if let Some(socket_address) = sender_info.socket_address {
match send_data_kind {
SendDataKind::LocalDirect => {

View File

@ -326,7 +326,7 @@ impl NodeInfo {
F: Fn(&DialInfoDetail) -> bool,
{
for did in &self.dial_info_detail_list {
if filter(&did) {
if filter(did) {
return Some(did.clone());
}
}
@ -340,7 +340,7 @@ impl NodeInfo {
let mut dial_info_detail_list = Vec::new();
for did in &self.dial_info_detail_list {
if filter(&did) {
if filter(did) {
dial_info_detail_list.push(did.clone());
}
}
@ -446,6 +446,7 @@ impl LocalNodeInfo {
}
}
#[allow(clippy::derive_hash_xor_eq)]
#[derive(Debug, PartialOrd, Ord, Hash, Serialize, Deserialize, EnumSetType)]
// Keep member order appropriate for sorting < preference
// Must match DialInfo order