hot reload fix
This commit is contained in:
parent
712659e86f
commit
74a9ccfaad
@ -156,17 +156,12 @@ using ValueSeqNum = UInt32; # sequence numbers for v
|
||||
|
||||
struct ValueKey @0xe64b0992c21a0736 {
|
||||
publicKey @0 :ValueID; # the location of the value
|
||||
subkey @1 :Text; # the name of the subkey (or empty if the whole key)
|
||||
subkey @1 :Text; # the name of the subkey (or empty for the default subkey)
|
||||
}
|
||||
|
||||
# struct ValueKeySeq {
|
||||
# key @0 :ValueKey; # the location of the value
|
||||
# seq @1 :ValueSeqNum; # the sequence number of the value subkey
|
||||
# }
|
||||
|
||||
struct ValueData @0xb4b7416f169f2a3d {
|
||||
data @0 :Data; # value or subvalue contents
|
||||
seq @1 :ValueSeqNum; # sequence number of value
|
||||
seq @0 :ValueSeqNum; # sequence number of value
|
||||
data @1 :Data; # value or subvalue contents
|
||||
}
|
||||
|
||||
# Operations
|
||||
|
@ -19,6 +19,7 @@ use tracing_subscriber::*;
|
||||
|
||||
// Globals
|
||||
lazy_static! {
|
||||
static ref CORE_INITIALIZED: Mutex<bool> = Mutex::new(false);
|
||||
static ref VEILID_API: AsyncMutex<Option<veilid_core::VeilidAPI>> = AsyncMutex::new(None);
|
||||
static ref FILTERS: Mutex<BTreeMap<&'static str, veilid_core::VeilidLayerFilter>> =
|
||||
Mutex::new(BTreeMap::new());
|
||||
@ -144,6 +145,17 @@ pub extern "C" fn initialize_veilid_flutter(dart_post_c_object_ptr: ffi::DartPos
|
||||
#[no_mangle]
|
||||
#[instrument]
|
||||
pub extern "C" fn initialize_veilid_core(platform_config: FfiStr) {
|
||||
|
||||
// Only do this once, ever
|
||||
// Until we have Dart native finalizers running on hot-restart, this will cause a crash if run more than once
|
||||
{
|
||||
let mut core_init = CORE_INITIALIZED.lock();
|
||||
if *core_init {
|
||||
return;
|
||||
}
|
||||
*core_init = true;
|
||||
}
|
||||
|
||||
let platform_config = platform_config.into_opt_string();
|
||||
let platform_config: VeilidFFIConfig = veilid_core::deserialize_opt_json(platform_config)
|
||||
.expect("failed to deserialize plaform config json");
|
||||
|
Loading…
Reference in New Issue
Block a user