mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-10-01 01:26:08 -04:00
signal work"
This commit is contained in:
parent
e677a72ab3
commit
b590e3f28a
@ -256,6 +256,7 @@ tracing-oslog = { version = "0.1.2", optional = true }
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
|
||||
simplelog = { version = "0.12.1", features = ["test"] }
|
||||
serial_test = "2.0.0"
|
||||
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
|
||||
serial_test = { version = "2.0.0", default-features = false, features = [
|
||||
|
@ -670,7 +670,7 @@ impl NetworkManager {
|
||||
let rpc = self.rpc_processor();
|
||||
|
||||
// Add the peer info to our routing table
|
||||
let peer_nr = match routing_table.register_node_with_peer_info(
|
||||
let mut peer_nr = match routing_table.register_node_with_peer_info(
|
||||
RoutingDomain::PublicInternet,
|
||||
peer_info,
|
||||
false,
|
||||
@ -684,10 +684,10 @@ impl NetworkManager {
|
||||
}
|
||||
};
|
||||
|
||||
// Restrict reverse connection to same protocol as inbound signal
|
||||
let peer_nr = peer_nr.filtered_clone(NodeRefFilter::from(
|
||||
signal_connection_descriptor.protocol_type(),
|
||||
));
|
||||
// Restrict reverse connection to same sequencing requirement as inbound signal
|
||||
if signal_connection_descriptor.protocol_type().is_ordered() {
|
||||
peer_nr.set_sequencing(Sequencing::EnsureOrdered);
|
||||
}
|
||||
|
||||
// Make a reverse connection to the peer and send the receipt to it
|
||||
rpc.rpc_call_return_receipt(Destination::direct(peer_nr), receipt)
|
||||
@ -1030,17 +1030,11 @@ impl NetworkManager {
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(relay_nr) = some_relay_nr {
|
||||
if let Some(mut relay_nr) = some_relay_nr {
|
||||
// Ensure the protocol used to forward is of the same sequencing requirement
|
||||
// Address type is allowed to change if connectivity is better
|
||||
let relay_nr = if connection_descriptor.protocol_type().is_ordered() {
|
||||
// XXX: this is a little redundant
|
||||
let (_, nrf) = NodeRefFilter::new().with_sequencing(Sequencing::EnsureOrdered);
|
||||
let mut relay_nr = relay_nr.filtered_clone(nrf);
|
||||
if connection_descriptor.protocol_type().is_ordered() {
|
||||
relay_nr.set_sequencing(Sequencing::EnsureOrdered);
|
||||
relay_nr
|
||||
} else {
|
||||
relay_nr
|
||||
};
|
||||
|
||||
// Relay the packet to the desired destination
|
||||
|
@ -305,6 +305,8 @@ impl Network {
|
||||
|
||||
// All done
|
||||
|
||||
log_net!(debug "Network class discovery finished with address_types {:?}", all_address_types);
|
||||
|
||||
// Set the address types we've seen
|
||||
editor.setup_network(
|
||||
protocol_config.outbound,
|
||||
|
@ -454,6 +454,7 @@ impl NetworkManager {
|
||||
bail!("signalreverse target noderef didn't match target key: {:?} != {} for relay {}", target_node_ref, target_key, relay_key );
|
||||
}
|
||||
relay_nr.set_sequencing(sequencing);
|
||||
let target_node_ref = target_node_ref.filtered_clone(NodeRefFilter::from(dial_info_filter));
|
||||
NodeContactMethod::SignalReverse(relay_nr, target_node_ref)
|
||||
}
|
||||
ContactMethod::SignalHolePunch(relay_key, target_key) => {
|
||||
@ -474,7 +475,7 @@ impl NetworkManager {
|
||||
// if any other protocol were possible here we could update this and do_hole_punch
|
||||
// but tcp hole punch is very very unreliable it seems
|
||||
let udp_target_node_ref = target_node_ref
|
||||
.filtered_clone(NodeRefFilter::new().with_protocol_type(ProtocolType::UDP));
|
||||
.filtered_clone(NodeRefFilter::new().with_dial_info_filter(dial_info_filter).with_protocol_type(ProtocolType::UDP));
|
||||
|
||||
NodeContactMethod::SignalHolePunch(relay_nr, udp_target_node_ref)
|
||||
}
|
||||
|
@ -97,6 +97,15 @@ impl From<AddressType> for DialInfoFilter {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ConnectionDescriptor> for DialInfoFilter {
|
||||
fn from(other: ConnectionDescriptor) -> Self {
|
||||
Self {
|
||||
protocol_type_set: ProtocolTypeSet::from(other.protocol_type()),
|
||||
address_type_set: AddressTypeSet::from(other.address_type()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait MatchesDialInfoFilter {
|
||||
fn matches_filter(&self, filter: &DialInfoFilter) -> bool;
|
||||
}
|
||||
|
@ -111,3 +111,12 @@ impl From<AddressType> for NodeRefFilter {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ConnectionDescriptor> for NodeRefFilter {
|
||||
fn from(other: ConnectionDescriptor) -> Self {
|
||||
Self {
|
||||
routing_domain_set: RoutingDomainSet::all(),
|
||||
dial_info_filter: DialInfoFilter::from(other),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ impl RoutingDomainEditor {
|
||||
|
||||
if this_changed {
|
||||
info!(
|
||||
"[{:?}] setup network: {:?} {:?} {:?} {:?}",
|
||||
"[{:?}] setup network: outbound {:?} inbound {:?} address types {:?} capabilities {:?}",
|
||||
self.routing_domain,
|
||||
outbound_protocols,
|
||||
inbound_protocols,
|
||||
|
@ -96,15 +96,15 @@ cfg_if! {
|
||||
|
||||
pub fn setup() {
|
||||
SETUP_ONCE.call_once(|| {
|
||||
use tracing_subscriber::{filter, fmt, prelude::*};
|
||||
let mut filters = filter::Targets::new().with_default(filter::LevelFilter::INFO);
|
||||
use tracing_subscriber::{EnvFilter, filter::LevelFilter, fmt, prelude::*};
|
||||
let mut env_filter = EnvFilter::builder().with_default_directive(LevelFilter::INFO.into()).from_env_lossy();
|
||||
for ig in DEFAULT_LOG_IGNORE_LIST {
|
||||
filters = filters.with_target(ig, filter::LevelFilter::OFF);
|
||||
env_filter = env_filter.add_directive(format!("{}=off", ig).parse().unwrap());
|
||||
}
|
||||
let fmt_layer = fmt::layer();
|
||||
tracing_subscriber::registry()
|
||||
.with(fmt_layer)
|
||||
.with(filters)
|
||||
.with(env_filter)
|
||||
.init();
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user