mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-10-01 01:26:08 -04:00
reduce frequency of interface resets on ios
This commit is contained in:
parent
e759e50983
commit
87a0e38e36
@ -27,6 +27,9 @@ else
|
||||
LIPO_OUT_NAME="lipo-ios"
|
||||
fi
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
LIPOS=""
|
||||
for arch in $ARCHS
|
||||
do
|
||||
if [ "$arch" == "arm64" ]; then
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
pushd $SCRIPTDIR >/dev/null
|
||||
|
||||
@ -23,6 +24,9 @@ ARCHS=${ARCHS:=arm64}
|
||||
|
||||
LIPO_OUT_NAME="lipo-darwin"
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
LIPOS=""
|
||||
for arch in $ARCHS
|
||||
do
|
||||
if [ "$arch" == "arm64" ]; then
|
||||
|
@ -351,6 +351,7 @@ impl Network {
|
||||
})
|
||||
.collect();
|
||||
addrs.sort();
|
||||
addrs.dedup();
|
||||
addrs
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ impl Network {
|
||||
|
||||
#[instrument(level = "trace", skip_all)]
|
||||
async fn create_udp_protocol_handler(&self, addr: SocketAddr) -> EyreResult<bool> {
|
||||
log_net!("create_udp_protocol_handler on {:?}", &addr);
|
||||
log_net!(debug "create_udp_protocol_handler on {:?}", &addr);
|
||||
|
||||
// Create a reusable socket
|
||||
let Some(socket) = new_bound_default_udp_socket(addr)? else {
|
||||
|
@ -116,6 +116,7 @@ impl NetworkManager {
|
||||
log_network_result!(debug "Reverse connection failed to {}, falling back to inbound relay via {}", target_node_ref, relay_nr);
|
||||
network_result_try!(this.try_possibly_relayed_contact_method(NodeContactMethod::InboundRelay(relay_nr), destination_node_ref, data).await?)
|
||||
} else {
|
||||
log_network_result!(debug "Reverse connection successful to {} via {}", target_node_ref, relay_nr);
|
||||
network_result_try!(nres)
|
||||
}
|
||||
}
|
||||
@ -128,6 +129,7 @@ impl NetworkManager {
|
||||
log_network_result!(debug "Hole punch failed to {}, falling back to inbound relay via {}", target_node_ref, relay_nr);
|
||||
network_result_try!(this.try_possibly_relayed_contact_method(NodeContactMethod::InboundRelay(relay_nr), destination_node_ref, data).await?)
|
||||
} else {
|
||||
log_network_result!(debug "Hole punch successful to {} via {}", target_node_ref, relay_nr);
|
||||
network_result_try!(nres)
|
||||
}
|
||||
}
|
||||
|
@ -599,13 +599,13 @@ impl BucketEntryInner {
|
||||
return;
|
||||
}
|
||||
self.envelope_support.push(envelope_version);
|
||||
self.envelope_support.dedup();
|
||||
self.envelope_support.sort();
|
||||
self.envelope_support.dedup();
|
||||
}
|
||||
|
||||
pub fn set_envelope_support(&mut self, mut envelope_support: Vec<u8>) {
|
||||
envelope_support.dedup();
|
||||
envelope_support.sort();
|
||||
envelope_support.dedup();
|
||||
self.envelope_support = envelope_support;
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,8 @@ impl RoutingTable {
|
||||
};
|
||||
envelope_support.push(es);
|
||||
}
|
||||
envelope_support.dedup();
|
||||
envelope_support.sort();
|
||||
envelope_support.dedup();
|
||||
|
||||
// Node Id
|
||||
let mut node_ids = TypedKeyGroup::new();
|
||||
|
@ -93,6 +93,7 @@ pub fn decode_node_info(reader: &veilid_capnp::node_info::Reader) -> Result<Node
|
||||
// Unsorted is okay, some nodes may have a different envelope order preference
|
||||
// But nothing should show up more than once
|
||||
let mut eversions = envelope_support.clone();
|
||||
eversions.sort();
|
||||
eversions.dedup();
|
||||
if eversions.len() != envelope_support.len() {
|
||||
return Err(RPCError::protocol("duplicate envelope versions"));
|
||||
@ -122,6 +123,7 @@ pub fn decode_node_info(reader: &veilid_capnp::node_info::Reader) -> Result<Node
|
||||
// Unsorted is okay, some nodes may have a different crypto order preference
|
||||
// But nothing should show up more than once
|
||||
let mut ckinds = crypto_support.clone();
|
||||
ckinds.sort();
|
||||
ckinds.dedup();
|
||||
if ckinds.len() != crypto_support.len() {
|
||||
return Err(RPCError::protocol("duplicate crypto kinds"));
|
||||
|
@ -629,6 +629,17 @@ impl RPCProcessor {
|
||||
// Reply received
|
||||
let recv_ts = get_aligned_timestamp();
|
||||
|
||||
// Record answer received
|
||||
self.record_answer_received(
|
||||
waitable_reply.send_ts,
|
||||
recv_ts,
|
||||
rpcreader.header.body_len,
|
||||
waitable_reply.node_ref.clone(),
|
||||
waitable_reply.safety_route,
|
||||
waitable_reply.remote_private_route,
|
||||
waitable_reply.reply_private_route,
|
||||
);
|
||||
|
||||
// Ensure the reply comes over the private route that was requested
|
||||
if let Some(reply_private_route) = waitable_reply.reply_private_route {
|
||||
match &rpcreader.header.detail {
|
||||
@ -648,17 +659,6 @@ impl RPCProcessor {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Record answer received
|
||||
self.record_answer_received(
|
||||
waitable_reply.send_ts,
|
||||
recv_ts,
|
||||
rpcreader.header.body_len,
|
||||
waitable_reply.node_ref.clone(),
|
||||
waitable_reply.safety_route,
|
||||
waitable_reply.remote_private_route,
|
||||
waitable_reply.reply_private_route,
|
||||
)
|
||||
}
|
||||
};
|
||||
out
|
||||
|
@ -116,7 +116,10 @@ where
|
||||
pub fn get_op_context(&self, op_id: OperationId) -> Result<C, RPCError> {
|
||||
let inner = self.inner.lock();
|
||||
let Some(waiting_op) = inner.waiting_op_table.get(&op_id) else {
|
||||
return Err(RPCError::ignore("Missing operation id getting op context"));
|
||||
return Err(RPCError::ignore(format!(
|
||||
"Missing operation id getting op context: id={}",
|
||||
op_id
|
||||
)));
|
||||
};
|
||||
Ok(waiting_op.context.clone())
|
||||
}
|
||||
|
@ -153,6 +153,10 @@ pub struct CmdlineArgs {
|
||||
#[cfg(feature = "rt-tokio")]
|
||||
#[arg(long)]
|
||||
console: bool,
|
||||
|
||||
/// change ingore_log_targets
|
||||
#[arg(long)]
|
||||
ignore_log_targets: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[instrument(level = "trace", skip_all, err)]
|
||||
@ -308,6 +312,11 @@ fn main() -> EyreResult<()> {
|
||||
settingsrw.logging.console.enabled = true;
|
||||
}
|
||||
|
||||
if let Some(ignore_log_targets) = args.ignore_log_targets {
|
||||
println!("Changing ignored log targets: {:?}", ignore_log_targets);
|
||||
settingsrw.logging.terminal.ignore_log_targets = ignore_log_targets
|
||||
}
|
||||
|
||||
drop(settingsrw);
|
||||
|
||||
// Set specific config settings
|
||||
|
@ -427,9 +427,15 @@ impl NetworkInterfaces {
|
||||
}
|
||||
|
||||
// Sort one more time to get the best interface addresses overall
|
||||
intf_addrs.sort();
|
||||
let mut addresses = intf_addrs
|
||||
.iter()
|
||||
.map(|x| x.if_addr().ip())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
addresses.sort();
|
||||
addresses.dedup();
|
||||
|
||||
// Now export just the addresses
|
||||
inner.interface_address_cache = intf_addrs.iter().map(|x| x.if_addr().ip()).collect()
|
||||
inner.interface_address_cache = addresses;
|
||||
}
|
||||
}
|
||||
|
@ -321,11 +321,12 @@ pub fn listen_address_to_socket_addrs(listen_address: &str) -> Result<Vec<Socket
|
||||
})
|
||||
}
|
||||
|
||||
pub trait Dedup<T: PartialEq + Clone> {
|
||||
/// Dedup, but doesn't require a sorted vec, and keeps the element order
|
||||
pub trait RemoveDuplicates<T: PartialEq + Clone> {
|
||||
fn remove_duplicates(&mut self);
|
||||
}
|
||||
|
||||
impl<T: PartialEq + Clone> Dedup<T> for Vec<T> {
|
||||
impl<T: PartialEq + Clone> RemoveDuplicates<T> for Vec<T> {
|
||||
fn remove_duplicates(&mut self) {
|
||||
let mut already_seen = Vec::new();
|
||||
self.retain(|item| match already_seen.contains(item) {
|
||||
|
Loading…
Reference in New Issue
Block a user