This commit is contained in:
John Smith 2022-02-15 13:40:17 -05:00
parent 125901fcd8
commit 7458d0d991
12 changed files with 191 additions and 103 deletions

View file

@ -119,7 +119,14 @@ pub extern "C" fn startup_veilid_core(port: i64, config: FfiStr) {
move |update: veilid_core::VeilidUpdate| -> veilid_core::SystemPinBoxFuture<()> {
let sink = sink.clone();
Box::pin(async move {
sink.item_json(update);
match update {
veilid_core::VeilidUpdate::Shutdown => {
sink.close();
}
_ => {
sink.item_json(update);
}
}
})
},
);
@ -159,6 +166,16 @@ pub extern "C" fn shutdown_veilid_core(port: i64) {
});
}
#[no_mangle]
pub extern "C" fn debug(port: i64, command: FfiStr) {
let command = command.into_opt_string().unwrap_or_default();
DartIsolateWrapper::new(port).spawn_result(async move {
let veilid_api = get_veilid_api().await?;
let out = veilid_api.debug(command).await?;
APIResult::Ok(out)
});
}
#[no_mangle]
pub extern "C" fn veilid_version_string() -> *mut c_char {
veilid_core::veilid_version_string().into_ffi_value()