ffi work
This commit is contained in:
@@ -1,2 +1,30 @@
|
||||
//use crate::intf::*;
|
||||
//use crate::xx::*;
|
||||
use crate::intf::*;
|
||||
use crate::*;
|
||||
|
||||
struct BlockStoreInner {
|
||||
//
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BlockStore {
|
||||
config: VeilidConfig,
|
||||
inner: Arc<Mutex<BlockStoreInner>>,
|
||||
}
|
||||
|
||||
impl BlockStore {
|
||||
fn new_inner() -> BlockStoreInner {
|
||||
BlockStoreInner {}
|
||||
}
|
||||
pub fn new(config: VeilidConfig) -> Self {
|
||||
Self {
|
||||
config,
|
||||
inner: Arc::new(Mutex::new(Self::new_inner())),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn init(&self) -> Result<(), String> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn terminate(&self) {}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ mod block_store;
|
||||
mod network;
|
||||
mod protected_store;
|
||||
mod system;
|
||||
pub mod table_store;
|
||||
mod table_store;
|
||||
pub mod utils;
|
||||
|
||||
pub use block_store::*;
|
||||
|
@@ -44,8 +44,8 @@ impl ProtectedStore {
|
||||
}
|
||||
|
||||
pub async fn init(&self) -> Result<(), String> {
|
||||
let c = self.config.get();
|
||||
{
|
||||
let delete = {
|
||||
let c = self.config.get();
|
||||
let mut inner = self.inner.lock();
|
||||
if !c.protected_store.always_use_insecure_storage {
|
||||
cfg_if! {
|
||||
@@ -74,9 +74,10 @@ impl ProtectedStore {
|
||||
if inner.keyring_manager.is_none() {
|
||||
return Err("Could not initialize the protected store.".to_owned());
|
||||
}
|
||||
}
|
||||
c.protected_store.delete
|
||||
};
|
||||
|
||||
if c.protected_store.delete {
|
||||
if delete {
|
||||
self.delete_all().await?;
|
||||
}
|
||||
|
||||
|
@@ -24,29 +24,6 @@ lazy_static! {
|
||||
}
|
||||
|
||||
pub fn veilid_core_setup_android_no_log<'a>(env: JNIEnv<'a>, ctx: JObject<'a>) {
|
||||
panic::set_hook(Box::new(|panic_info| {
|
||||
let bt = Backtrace::new();
|
||||
if let Some(location) = panic_info.location() {
|
||||
error!(
|
||||
"panic occurred in file '{}' at line {}",
|
||||
location.file(),
|
||||
location.line(),
|
||||
);
|
||||
} else {
|
||||
error!("panic occurred but can't get location information...");
|
||||
}
|
||||
if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
|
||||
error!("panic payload: {:?}", s);
|
||||
} else if let Some(s) = panic_info.payload().downcast_ref::<String>() {
|
||||
error!("panic payload: {:?}", s);
|
||||
} else if let Some(a) = panic_info.payload().downcast_ref::<std::fmt::Arguments>() {
|
||||
error!("panic payload: {:?}", a);
|
||||
} else {
|
||||
error!("no panic payload");
|
||||
}
|
||||
error!("Backtrace:\n{:?}", bt);
|
||||
}));
|
||||
|
||||
*ANDROID_GLOBALS.lock() = Some(AndroidGlobals {
|
||||
vm: env.get_java_vm().unwrap(),
|
||||
ctx: env.new_global_ref(ctx).unwrap(),
|
||||
@@ -70,6 +47,29 @@ pub fn veilid_core_setup_android<'a>(
|
||||
),
|
||||
);
|
||||
|
||||
panic::set_hook(Box::new(|panic_info| {
|
||||
let bt = Backtrace::new();
|
||||
if let Some(location) = panic_info.location() {
|
||||
error!(
|
||||
"panic occurred in file '{}' at line {}",
|
||||
location.file(),
|
||||
location.line(),
|
||||
);
|
||||
} else {
|
||||
error!("panic occurred but can't get location information...");
|
||||
}
|
||||
if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
|
||||
error!("panic payload: {:?}", s);
|
||||
} else if let Some(s) = panic_info.payload().downcast_ref::<String>() {
|
||||
error!("panic payload: {:?}", s);
|
||||
} else if let Some(a) = panic_info.payload().downcast_ref::<std::fmt::Arguments>() {
|
||||
error!("panic payload: {:?}", a);
|
||||
} else {
|
||||
error!("no panic payload");
|
||||
}
|
||||
error!("Backtrace:\n{:?}", bt);
|
||||
}));
|
||||
|
||||
veilid_core_setup_android_no_log(env, ctx);
|
||||
}
|
||||
|
||||
|
@@ -1 +1,31 @@
|
||||
|
||||
use crate::intf::*;
|
||||
use crate::*;
|
||||
|
||||
struct BlockStoreInner {
|
||||
//
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BlockStore {
|
||||
config: VeilidConfig,
|
||||
inner: Arc<Mutex<BlockStoreInner>>,
|
||||
}
|
||||
|
||||
impl BlockStore {
|
||||
fn new_inner() -> BlockStoreInner {
|
||||
BlockStoreInner {}
|
||||
}
|
||||
pub fn new(config: VeilidConfig) -> Self {
|
||||
Self {
|
||||
config,
|
||||
inner: Arc::new(Mutex::new(Self::new_inner())),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn init(&self) -> Result<(), String> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn terminate(&self) {}
|
||||
}
|
||||
|
@@ -78,7 +78,7 @@ impl WebsocketProtocolHandler {
|
||||
assert!(local_address.is_none());
|
||||
|
||||
// Split dial info up
|
||||
let (tls, scheme) = match &dial_info {
|
||||
let (_tls, scheme) = match &dial_info {
|
||||
DialInfo::WS(_) => (false, "ws"),
|
||||
DialInfo::WSS(_) => (true, "wss"),
|
||||
_ => panic!("invalid dialinfo for WS/WSS protocol"),
|
||||
|
Reference in New Issue
Block a user