mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
Support async futures that have empty response.
This commit is contained in:
parent
35bc9ddf63
commit
e293c204a0
1 changed files with 14 additions and 7 deletions
|
@ -97,13 +97,20 @@ pub extern "C" fn msg_from_js(d: *const DenoC, buf: deno_buf) {
|
||||||
let future = future.and_then(move |maybe_box_u8| {
|
let future = future.and_then(move |maybe_box_u8| {
|
||||||
let buf = match maybe_box_u8 {
|
let buf = match maybe_box_u8 {
|
||||||
Some(box_u8) => deno_buf_from(box_u8),
|
Some(box_u8) => deno_buf_from(box_u8),
|
||||||
// Send back null deno_buf.
|
None => {
|
||||||
None => deno_buf {
|
// async RPCs that return None still need to
|
||||||
alloc_ptr: 0 as *mut u8,
|
// send a message back to signal completion.
|
||||||
alloc_len: 0,
|
let builder = &mut FlatBufferBuilder::new();
|
||||||
data_ptr: 0 as *mut u8,
|
deno_buf_from(
|
||||||
data_len: 0,
|
serialize_response(
|
||||||
},
|
cmd_id,
|
||||||
|
builder,
|
||||||
|
msg::BaseArgs {
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
).unwrap(),
|
||||||
|
)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// TODO(ry) make this thread safe.
|
// TODO(ry) make this thread safe.
|
||||||
unsafe { libdeno::deno_send(d, buf) };
|
unsafe { libdeno::deno_send(d, buf) };
|
||||||
|
|
Loading…
Add table
Reference in a new issue