[rialto][vsock] Buffer the write from rialto to the host
This cl implements a write buffer for transmitting data from
rialto to the host to improve the communication efficiency.
Test: atest rialto_test
Bug: 293411448
Change-Id: I3e81dcb6c336f4279d25b168d0841ffe2f3265ec
diff --git a/rialto/src/main.rs b/rialto/src/main.rs
index a8338ca..42d39c4 100644
--- a/rialto/src/main.rs
+++ b/rialto/src/main.rs
@@ -26,6 +26,7 @@
use crate::communication::VsockStream;
use crate::error::{Error, Result};
+use ciborium_io::Write;
use core::num::NonZeroUsize;
use core::slice;
use fdtpci::PciInfo;
@@ -141,6 +142,7 @@
let mut vsock_stream = VsockStream::new(socket_device, host_addr())?;
let response = requests::process_request(vsock_stream.read_request()?);
vsock_stream.write_response(&response)?;
+ vsock_stream.flush()?;
vsock_stream.shutdown()?;
Ok(())