Merge branch 'develop' into dr/settings-page

This commit is contained in:
doria 2024-04-29 21:02:17 +09:00 committed by GitHub
commit 0eea822c22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 58 additions and 72 deletions

View File

@ -25,7 +25,7 @@ zip = "0.6"
simulation-mode = [] simulation-mode = []
[dependencies] [dependencies]
aes-gcm = "0.10.2" aes-gcm = "0.10.3"
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4", features = ["ws"]} alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4", features = ["ws"]}
@ -76,7 +76,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
serde_urlencoded = "0.7" serde_urlencoded = "0.7"
sha2 = "0.10" sha2 = "0.10"
snow = { version = "0.9.3", features = ["ring-resolver"] } snow = { version = "0.9.5", features = ["ring-resolver"] }
static_dir = "0.2.0" static_dir = "0.2.0"
thiserror = "1.0" thiserror = "1.0"
tokio = { version = "1.28", features = ["fs", "macros", "rt-multi-thread", "signal", "sync"] } tokio = { version = "1.28", features = ["fs", "macros", "rt-multi-thread", "signal", "sync"] }

View File

@ -607,7 +607,7 @@ pub async fn make_process_loop(
}; };
// the process will run until it returns from init() or crashes // the process will run until it returns from init() or crashes
let is_error = match bindings match bindings
.call_init(&mut store, &metadata.our.to_string()) .call_init(&mut store, &metadata.our.to_string())
.await .await
{ {
@ -618,7 +618,6 @@ pub async fn make_process_loop(
content: format!("process {} returned without error", metadata.our.process), content: format!("process {} returned without error", metadata.our.process),
}) })
.await; .await;
false
} }
Err(_) => { Err(_) => {
let stderr = wasi_stderr.contents().into(); let stderr = wasi_stderr.contents().into();
@ -632,7 +631,6 @@ pub async fn make_process_loop(
), ),
}) })
.await; .await;
true
} }
}; };
@ -715,73 +713,61 @@ pub async fn make_process_loop(
lazy_load_blob: None, lazy_load_blob: None,
}) })
.await?; .await?;
if is_error { let _ = send_to_terminal
let _ = send_to_terminal .send(t::Printout {
.send(t::Printout { verbosity: 1,
verbosity: 0, content: format!(
content: format!( "firing OnExit::Restart for process {}",
"skipping OnExit::Restart for process {} due to crash", metadata.our.process
metadata.our.process ),
), })
}) .await;
.await; send_to_loop
} else { .send(t::KernelMessage {
let _ = send_to_terminal id: rand::random(),
.send(t::Printout { source: our_kernel.clone(),
verbosity: 1, target: our_kernel.clone(),
content: format!( rsvp: None,
"firing OnExit::Restart for process {}", message: t::Message::Request(t::Request {
metadata.our.process inherit: false,
), expects_response: None,
}) body: serde_json::to_vec(&t::KernelCommand::InitializeProcess {
.await; id: metadata.our.process.clone(),
send_to_loop wasm_bytes_handle: metadata.wasm_bytes_handle,
.send(t::KernelMessage { wit_version: Some(metadata.wit_version),
id: rand::random(), on_exit: metadata.on_exit,
source: our_kernel.clone(), initial_capabilities,
target: our_kernel.clone(), public: metadata.public,
rsvp: None, })
message: t::Message::Request(t::Request { .unwrap(),
inherit: false, metadata: None,
expects_response: None, capabilities: vec![],
body: serde_json::to_vec(&t::KernelCommand::InitializeProcess { }),
id: metadata.our.process.clone(), lazy_load_blob: Some(t::LazyLoadBlob {
wasm_bytes_handle: metadata.wasm_bytes_handle, mime: None,
wit_version: Some(metadata.wit_version), bytes: wasm_bytes,
on_exit: metadata.on_exit, }),
initial_capabilities, })
public: metadata.public, .await?;
}) send_to_loop
.unwrap(), .send(t::KernelMessage {
metadata: None, id: rand::random(),
capabilities: vec![], source: our_kernel.clone(),
}), target: our_kernel.clone(),
lazy_load_blob: Some(t::LazyLoadBlob { rsvp: None,
mime: None, message: t::Message::Request(t::Request {
bytes: wasm_bytes, inherit: false,
}), expects_response: None,
}) body: serde_json::to_vec(&t::KernelCommand::RunProcess(
.await?; metadata.our.process.clone(),
send_to_loop ))
.send(t::KernelMessage { .unwrap(),
id: rand::random(), metadata: None,
source: our_kernel.clone(), capabilities: vec![],
target: our_kernel.clone(), }),
rsvp: None, lazy_load_blob: None,
message: t::Message::Request(t::Request { })
inherit: false, .await?;
expects_response: None,
body: serde_json::to_vec(&t::KernelCommand::RunProcess(
metadata.our.process.clone(),
))
.unwrap(),
metadata: None,
capabilities: vec![],
}),
lazy_load_blob: None,
})
.await?;
}
} }
// if requests, fire them // if requests, fire them
// even in death, a process can only message processes it has capabilities for // even in death, a process can only message processes it has capabilities for