Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions vm/devices/vmbus/vmbus_server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,10 @@ pub struct VmbusServerBuilder<'a, T: Spawn> {
send_messages_while_stopped: bool,
}

#[expect(clippy::large_enum_variant)]
#[derive(mesh::MeshPayload)]
/// The request to send to the proxy to set or clear its saved state cache.
pub enum SavedStateRequest {
Set(FailableRpc<channels::SavedState, ()>),
Set(FailableRpc<Box<channels::SavedState>, ()>),
Clear(Rpc<(), ()>),
}

Expand Down Expand Up @@ -210,13 +209,12 @@ impl From<ModifyConnectionRequest> for ModifyRelayRequest {
}
}

#[expect(clippy::large_enum_variant)]
#[derive(Debug)]
enum VmbusRequest {
Reset(Rpc<(), ()>),
Inspect(inspect::Deferred),
Save(Rpc<(), SavedState>),
Restore(Rpc<SavedState, Result<(), RestoreError>>),
Restore(Rpc<Box<SavedState>, Result<(), RestoreError>>),
Start,
Stop(Rpc<(), ()>),
}
Expand Down Expand Up @@ -575,7 +573,7 @@ impl VmbusServer {

pub async fn restore(&self, state: SavedState) -> Result<(), RestoreError> {
self.task_send
.call(VmbusRequest::Restore, state)
.call(VmbusRequest::Restore, Box::new(state))
.await
.unwrap()
}
Expand Down Expand Up @@ -972,12 +970,12 @@ impl ServerTask {
lost_synic_bug_fixed: true,
}),
VmbusRequest::Restore(rpc) => {
rpc.handle(async |state: SavedState| {
rpc.handle(async |state| {
self.unstick_on_start = !state.lost_synic_bug_fixed;
if let Some(sender) = &self.inner.saved_state_notify {
tracing::trace!("sending saved state to proxy");
if let Err(err) = sender
.call_failable(SavedStateRequest::Set, state.server.clone())
.call_failable(SavedStateRequest::Set, Box::new(state.server.clone()))
.await
{
tracing::error!(
Expand Down
4 changes: 2 additions & 2 deletions vm/devices/vmbus/vmbus_server/src/proxyintegration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ impl ProxyTask {
let mut proxy_ids: HashMap<u32, u64> = HashMap::new();
tracing::trace!("restoring channels...");

rpc.handle_failable(async |saved_state: SavedState| {
rpc.handle_failable(async |saved_state| {
// Restore channel state in the proxy for each channel in the SavedState.
if let Some(channels) = saved_state.channels() {
for channel in channels {
Expand Down Expand Up @@ -844,7 +844,7 @@ impl ProxyTask {
return Err(anyhow!("No channels exist in the saved state"));
}

*saved_state_option = Some(saved_state);
*saved_state_option = Some(*saved_state);
Ok(())
})
.await;
Expand Down