From 4b8bbdc3dcf822c0d5cc971eafdad71c06dbb530 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 7 Jun 2020 15:13:20 +0800 Subject: [PATCH] send RPC requests to host --- src/runtime/src/comms.rs | 4 +++- src/runtime/src/proto_async.rs | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/runtime/src/comms.rs b/src/runtime/src/comms.rs index 67d8ddc..8dfdfda 100644 --- a/src/runtime/src/comms.rs +++ b/src/runtime/src/comms.rs @@ -147,7 +147,9 @@ async fn handle_connection(stream: &TcpStream, control: Rc { - debug!("RPC: is_async={} data={:?}", is_async, data); + write_header(&stream, Reply::RPCRequest).await?; + write_bool(&stream, is_async).await?; + stream.send(data.iter().copied()).await?; }, _ => { error!("received unexpected message from core1 while kernel was running: {:?}", reply); diff --git a/src/runtime/src/proto_async.rs b/src/runtime/src/proto_async.rs index 95c24a3..3a35d7c 100644 --- a/src/runtime/src/proto_async.rs +++ b/src/runtime/src/proto_async.rs @@ -84,6 +84,11 @@ pub async fn write_i8(stream: &TcpStream, value: i8) -> Result<()> { Ok(()) } +pub async fn write_bool(stream: &TcpStream, value: bool) -> Result<()> { + stream.send([value as u8].iter().copied()).await?; + Ok(()) +} + pub async fn write_i32(stream: &TcpStream, value: i32) -> Result<()> { stream.send([ (value >> 24) as u8,