clean up handling of errors in route spec store

This commit is contained in:
Christien Rioux
2023-10-20 22:39:09 -04:00
parent 353c907497
commit 97be49a9a7
17 changed files with 278 additions and 236 deletions

View File

@@ -26,6 +26,7 @@ rt-tokio = [
"tokio-util",
"opentelemetry/rt-tokio",
]
debug-load = ["dep:ctor", "dep:libc-print", "dep:android_log-sys", "dep:oslog"]
[dependencies]
veilid-core = { path = "../../veilid-core", default-features = false }
@@ -56,9 +57,8 @@ allo-isolate = "0.1.20"
ffi-support = "0.4.4"
lazy_static = "1.4.0"
hostname = "0.3.1"
# loader debugging
ctor = "0.2.5"
libc-print = "0.1.22"
ctor = { version = "0.2.5", optional = true }
libc-print = { version = "0.1.22", optional = true }
# Dependencies for WASM builds only
@@ -68,8 +68,8 @@ libc-print = "0.1.22"
[target.'cfg(target_os = "android")'.dependencies]
jni = "0.21.1"
paranoid-android = "0.2.1"
android_log-sys = "0.3.1"
android_log-sys = { version = "0.3.1", optional = true }
# Dependencies for Android builds only
[target.'cfg(target_os = "ios")'.dependencies]
oslog = { version = "0.2.0", default-features = false }
oslog = { version = "0.2.0", default-features = false, optional = true }

View File

@@ -17,35 +17,39 @@ use veilid_core::tools::*;
use veilid_core::Encodable as _;
// Detect flutter load/unload
#[ctor::ctor]
fn onload() {
cfg_if! {
if #[cfg(target_os="android")] {
use android_log_sys::*;
use std::ffi::{CString, c_int, c_char};
unsafe {
let tag = CString::new("veilid").unwrap();
let text = CString::new(">>> VEILID-FLUTTER LOADED <<<").unwrap();
__android_log_write(LogPriority::INFO as c_int, tag.as_ptr() as *const c_char, text.as_ptr() as *const c_char);
cfg_if! {
if #[cfg(feature="debug-load")] {
#[ctor::ctor]
fn onload() {
cfg_if! {
if #[cfg(target_os="android")] {
use android_log_sys::*;
use std::ffi::{CString, c_int, c_char};
unsafe {
let tag = CString::new("veilid").unwrap();
let text = CString::new(">>> VEILID-FLUTTER LOADED <<<").unwrap();
__android_log_write(LogPriority::INFO as c_int, tag.as_ptr() as *const c_char, text.as_ptr() as *const c_char);
}
} else {
libc_print::libc_println!(">>> VEILID-FLUTTER LOADED <<<");
}
}
} else {
libc_print::libc_println!(">>> VEILID-FLUTTER LOADED <<<");
}
}
}
#[ctor::dtor]
fn onunload() {
cfg_if! {
if #[cfg(target_os="android")] {
use android_log_sys::*;
use std::ffi::{CString, c_int, c_char};
unsafe {
let tag = CString::new("veilid").unwrap();
let text = CString::new(">>> VEILID-FLUTTER UNLOADED <<<").unwrap();
__android_log_write(LogPriority::INFO as c_int, tag.as_ptr() as *const c_char, text.as_ptr() as *const c_char);
#[ctor::dtor]
fn onunload() {
cfg_if! {
if #[cfg(target_os="android")] {
use android_log_sys::*;
use std::ffi::{CString, c_int, c_char};
unsafe {
let tag = CString::new("veilid").unwrap();
let text = CString::new(">>> VEILID-FLUTTER UNLOADED <<<").unwrap();
__android_log_write(LogPriority::INFO as c_int, tag.as_ptr() as *const c_char, text.as_ptr() as *const c_char);
}
} else {
libc_print::libc_println!(">>> VEILID-FLUTTER UNLOADED <<<");
}
}
} else {
libc_print::libc_println!(">>> VEILID-FLUTTER UNLOADED <<<");
}
}
}