bugfixes!

This commit is contained in:
dr-frmr 2023-11-30 15:14:11 -05:00
parent 402a1d2170
commit eb5924661d
No known key found for this signature in database
4 changed files with 37 additions and 43 deletions

2
Cargo.lock generated
View File

@ -5093,7 +5093,7 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]] [[package]]
name = "uqbar" name = "uqbar"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"aes-gcm 0.10.2", "aes-gcm 0.10.2",
"anyhow", "anyhow",

View File

@ -585,9 +585,6 @@ async fn handle_app_message(
// the receiver will automatically trigger a 503 when sender is dropped. // the receiver will automatically trigger a 503 when sender is dropped.
return; return;
}; };
let Some((_id, (path, channel))) = http_response_senders.remove(&km.id) else {
return;
};
// XX REFACTOR THIS: // XX REFACTOR THIS:
// for the login case, todo refactor out? // for the login case, todo refactor out?
let segments: Vec<&str> = path let segments: Vec<&str> = path
@ -638,7 +635,7 @@ async fn handle_app_message(
} }
} }
} }
let _ = channel.send(( let _ = sender.send((
HttpResponse { HttpResponse {
status: response.status, status: response.status,
headers: response.headers, headers: response.headers,

View File

@ -201,30 +201,30 @@ async fn handle_kernel_request(
valid_capabilities.insert(cap); valid_capabilities.insert(cap);
} }
// if process is not public, give the initializer and itself the messaging cap. // give the initializer and itself the messaging cap.
if !public { // NOTE: we do this even if the process is public, because
valid_capabilities.insert(t::Capability { // a process might redundantly call grant_messaging.
issuer: t::Address { valid_capabilities.insert(t::Capability {
node: our_name.clone(), issuer: t::Address {
process: id.clone(), node: our_name.clone(),
}, process: id.clone(),
params: "\"messaging\"".into(), },
}); params: "\"messaging\"".into(),
caps_oracle });
.send(t::CapMessage::Add { caps_oracle
on: km.source.process.clone(), .send(t::CapMessage::Add {
cap: t::Capability { on: km.source.process.clone(),
issuer: t::Address { cap: t::Capability {
node: our_name.clone(), issuer: t::Address {
process: id.clone(), node: our_name.clone(),
}, process: id.clone(),
params: "\"messaging\"".into(),
}, },
responder: tokio::sync::oneshot::channel().0, params: "\"messaging\"".into(),
}) },
.await responder: tokio::sync::oneshot::channel().0,
.expect("event loop: fatal: sender died"); })
} .await
.expect("event loop: fatal: sender died");
// fires "success" response back if successful // fires "success" response back if successful
match start_process( match start_process(

View File

@ -354,19 +354,13 @@ impl ProcessState {
println!("need non-None prompting_message to handle Response"); println!("need non-None prompting_message to handle Response");
return None; return None;
}; };
match &prompting_message.rsvp { Some((
None => { prompting_message.id,
let _ = self match &prompting_message.rsvp {
.send_to_terminal None => prompting_message.source.clone(),
.send(t::Printout { Some(address) => address.clone(),
verbosity: 1, },
content: "kernel: prompting_message has no rsvp".into(), ))
})
.await;
None
}
Some(address) => Some((prompting_message.id, address.clone())),
}
} }
} }
@ -419,7 +413,7 @@ pub async fn make_process_loop(
} }
let component = 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); let mut linker = Linker::new(&engine);
Process::add_to_linker(&mut linker, |state: &mut ProcessWasi| state).unwrap(); Process::add_to_linker(&mut linker, |state: &mut ProcessWasi| state).unwrap();
@ -564,7 +558,10 @@ pub async fn make_process_loop(
.unwrap(), .unwrap(),
metadata: None, metadata: None,
}), }),
payload: None, payload: Some(t::Payload {
mime: None,
bytes: wasm_bytes,
}),
signed_capabilities: None, signed_capabilities: None,
}) })
.await .await