refactor checkpoint
This commit is contained in:
@@ -614,7 +614,7 @@ impl Network {
|
||||
return;
|
||||
}
|
||||
// Add network to local networks table
|
||||
for addr in intf.addrs {
|
||||
for addr in &intf.addrs {
|
||||
let netmask = addr.if_addr().netmask();
|
||||
let network_ip = ipaddr_apply_netmask(addr.if_addr().ip(), netmask);
|
||||
local_networks.insert((network_ip, netmask));
|
||||
|
||||
@@ -132,8 +132,10 @@ impl DiscoveryContext {
|
||||
false
|
||||
}
|
||||
};
|
||||
let filter =
|
||||
RoutingTable::combine_filters(inbound_dial_info_entry_filter, disallow_relays_filter);
|
||||
let filter = RoutingTable::combine_entry_filters(
|
||||
inbound_dial_info_entry_filter,
|
||||
disallow_relays_filter,
|
||||
);
|
||||
|
||||
// Find public nodes matching this filter
|
||||
let peers = self
|
||||
@@ -155,7 +157,11 @@ impl DiscoveryContext {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
peer.set_filter(Some(dial_info_filter.clone()));
|
||||
peer.set_filter(Some(
|
||||
NodeRefFilter::new()
|
||||
.with_routing_domain(RoutingDomain::PublicInternet)
|
||||
.with_dial_info_filter(dial_info_filter.clone()),
|
||||
));
|
||||
if let Some(sa) = self.request_public_address(peer.clone()).await {
|
||||
return Some((sa, peer));
|
||||
}
|
||||
@@ -764,7 +770,7 @@ impl Network {
|
||||
// Get existing public dial info
|
||||
let existing_public_dial_info: HashSet<DialInfoDetail> = routing_table
|
||||
.all_filtered_dial_info_details(
|
||||
Some(RoutingDomain::PublicInternet),
|
||||
RoutingDomain::PublicInternet.into(),
|
||||
&DialInfoFilter::all(),
|
||||
)
|
||||
.into_iter()
|
||||
|
||||
@@ -287,14 +287,11 @@ impl Network {
|
||||
|
||||
// Register local dial info
|
||||
for di in &local_dial_info_list {
|
||||
|
||||
xxx write routing table sieve for routing domain from dialinfo and local network detection and registration
|
||||
|
||||
// If the local interface address is global, or we are enabling local peer scope
|
||||
// register global dial info if no public address is specified
|
||||
// If the local interface address is global, then register global dial info
|
||||
// if no other public address is specified
|
||||
if !detect_address_changes
|
||||
&& public_address.is_none()
|
||||
&& (di.is_global() || enable_local_peer_scope)
|
||||
&& routing_table.ensure_dial_info_is_valid(RoutingDomain::PublicInternet, &di)
|
||||
{
|
||||
routing_table.register_dial_info(
|
||||
RoutingDomain::PublicInternet,
|
||||
@@ -455,7 +452,7 @@ xxx write routing table sieve for routing domain from dialinfo and local network
|
||||
|
||||
if !detect_address_changes
|
||||
&& url.is_none()
|
||||
&& (socket_address.address().is_global() || enable_local_peer_scope)
|
||||
&& routing_table.ensure_dial_info_is_valid(RoutingDomain::PublicInternet, &local_di)
|
||||
{
|
||||
// Register public dial info
|
||||
routing_table.register_dial_info(
|
||||
@@ -625,7 +622,7 @@ xxx write routing table sieve for routing domain from dialinfo and local network
|
||||
// Register global dial info if no public address is specified
|
||||
if !detect_address_changes
|
||||
&& public_address.is_none()
|
||||
&& (di.is_global() || enable_local_peer_scope)
|
||||
&& routing_table.ensure_dial_info_is_valid(RoutingDomain::PublicInternet, &di)
|
||||
{
|
||||
routing_table.register_dial_info(
|
||||
RoutingDomain::PublicInternet,
|
||||
|
||||
Reference in New Issue
Block a user