Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmbus_client: Fix bad merge and unbreak main #639

Merged
merged 2 commits into from
Jan 9, 2025
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
14 changes: 8 additions & 6 deletions vm/devices/vmbus/vmbus_client/src/hvsock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ impl HvsockRequestTracker {
return None;
}
if let Some(index) = self.pending_requests.iter().position(|request| {
request.0.service_id == result.service_id && request.0.endpoint_id == result.endpoint_id
request.input().service_id == result.service_id
&& request.input().endpoint_id == result.endpoint_id
}) {
let rpc = self.pending_requests.swap_remove(index);
Some(rpc)
Expand All @@ -61,14 +62,15 @@ impl HvsockRequestTracker {
// Since silo_id isn't part of the result message, it doesn't need to be checked here
// either.
let Some(index) = self.pending_requests.iter().position(|request| {
request.0.service_id == offer.interface_id && request.0.endpoint_id == offer.instance_id
request.input().service_id == offer.interface_id
&& request.input().endpoint_id == offer.instance_id
}) else {
tracing::warn!(?offer, "Channel offer for unknown hvsock request");
return None;
};

let rpc = self.pending_requests.swap_remove(index);
tracing::debug!(request = ?rpc.0, "channel offer matches hvsocket request");
tracing::debug!(request = ?rpc.input(), "channel offer matches hvsocket request");
Some(rpc)
}
}
Expand All @@ -91,7 +93,7 @@ mod tests {
silo_id: Guid::new_random(),
};

tracker.add_request(Rpc(request, mesh::oneshot().0));
tracker.add_request(Rpc::detached(request));
assert_eq!(1, tracker.pending_requests.len());

// Endpoint ID mismatch.
Expand Down Expand Up @@ -133,7 +135,7 @@ mod tests {
silo_id: Guid::new_random(),
};

tracker.add_request(Rpc(request, mesh::oneshot().0));
tracker.add_request(Rpc::detached(request));
assert_eq!(1, tracker.pending_requests.len());

// Endpoint ID mismatch.
Expand All @@ -155,7 +157,7 @@ mod tests {
// Match.
let offer = create_offer(request.service_id, request.endpoint_id, true, false);
let found = tracker.check_offer(&offer).unwrap();
assert_eq!(found.0, request);
assert_eq!(*found.input(), request);
assert_eq!(0, tracker.pending_requests.len());

// It no longer exists.
Expand Down
3 changes: 1 addition & 2 deletions vm/devices/vmbus/vmbus_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,8 @@ impl<T: VmbusMessageSource> ClientTask<T> {
// The client only supports protocol versions which use the newer message format.
// The host will not send a TlConnectRequestResult message on success, so a response to this
// message is not guaranteed.
let request = rpc.0;
let message = protocol::TlConnectRequest2::from(*rpc.input());
self.hvsock_tracker.add_request(rpc);
let message = protocol::TlConnectRequest2::from(request);
self.inner.send(&message);
}

Expand Down
Loading