diff --git a/Cargo.lock b/Cargo.lock index 3a4ecf23..fc6e3beb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5093,7 +5093,7 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "uqbar" -version = "0.3.0" +version = "0.4.0" dependencies = [ "aes-gcm 0.10.2", "anyhow", diff --git a/src/http/server.rs b/src/http/server.rs index 25152b52..2eff6bf1 100644 --- a/src/http/server.rs +++ b/src/http/server.rs @@ -585,9 +585,6 @@ async fn handle_app_message( // the receiver will automatically trigger a 503 when sender is dropped. return; }; - let Some((_id, (path, channel))) = http_response_senders.remove(&km.id) else { - return; - }; // XX REFACTOR THIS: // for the login case, todo refactor out? let segments: Vec<&str> = path @@ -638,7 +635,7 @@ async fn handle_app_message( } } } - let _ = channel.send(( + let _ = sender.send(( HttpResponse { status: response.status, headers: response.headers, diff --git a/src/kernel/mod.rs b/src/kernel/mod.rs index 78f96e60..c56cbd9b 100644 --- a/src/kernel/mod.rs +++ b/src/kernel/mod.rs @@ -201,30 +201,30 @@ async fn handle_kernel_request( valid_capabilities.insert(cap); } - // if process is not public, give the initializer and itself the messaging cap. - if !public { - valid_capabilities.insert(t::Capability { - issuer: t::Address { - node: our_name.clone(), - process: id.clone(), - }, - params: "\"messaging\"".into(), - }); - caps_oracle - .send(t::CapMessage::Add { - on: km.source.process.clone(), - cap: t::Capability { - issuer: t::Address { - node: our_name.clone(), - process: id.clone(), - }, - params: "\"messaging\"".into(), + // give the initializer and itself the messaging cap. + // NOTE: we do this even if the process is public, because + // a process might redundantly call grant_messaging. + valid_capabilities.insert(t::Capability { + issuer: t::Address { + node: our_name.clone(), + process: id.clone(), + }, + params: "\"messaging\"".into(), + }); + caps_oracle + .send(t::CapMessage::Add { + on: km.source.process.clone(), + cap: t::Capability { + issuer: t::Address { + node: our_name.clone(), + process: id.clone(), }, - responder: tokio::sync::oneshot::channel().0, - }) - .await - .expect("event loop: fatal: sender died"); - } + params: "\"messaging\"".into(), + }, + responder: tokio::sync::oneshot::channel().0, + }) + .await + .expect("event loop: fatal: sender died"); // fires "success" response back if successful match start_process( diff --git a/src/kernel/process.rs b/src/kernel/process.rs index 67b9a3c7..b708da41 100644 --- a/src/kernel/process.rs +++ b/src/kernel/process.rs @@ -354,19 +354,13 @@ impl ProcessState { println!("need non-None prompting_message to handle Response"); return None; }; - match &prompting_message.rsvp { - None => { - let _ = self - .send_to_terminal - .send(t::Printout { - verbosity: 1, - content: "kernel: prompting_message has no rsvp".into(), - }) - .await; - None - } - Some(address) => Some((prompting_message.id, address.clone())), - } + Some(( + prompting_message.id, + match &prompting_message.rsvp { + None => prompting_message.source.clone(), + Some(address) => address.clone(), + }, + )) } } @@ -419,7 +413,7 @@ pub async fn make_process_loop( } let component = - Component::new(&engine, wasm_bytes).expect("make_process_loop: couldn't read file"); + Component::new(&engine, wasm_bytes.clone()).expect("make_process_loop: couldn't read file"); let mut linker = Linker::new(&engine); Process::add_to_linker(&mut linker, |state: &mut ProcessWasi| state).unwrap(); @@ -564,7 +558,10 @@ pub async fn make_process_loop( .unwrap(), metadata: None, }), - payload: None, + payload: Some(t::Payload { + mime: None, + bytes: wasm_bytes, + }), signed_capabilities: None, }) .await