@@ -203,15 +203,15 @@ impl VmService {
203203 InspectService ( Option < ( mesh:: CancelContext , InspectService ) > ) ,
204204 WorkerRpc ( Result < WorkerRpc < ( ) > , mesh:: RecvError > ) ,
205205 ControllerEvent ( Option < VmControllerEvent > ) ,
206- WaitVmCancelled ,
206+ WaitVmCancelled ( CancelReason ) ,
207207 }
208208
209209 let action = futures:: select! { // merge semantics
210210 m = vm_service_recv. next( ) => Action :: VmService ( Box :: new( m) ) ,
211211 m = inspect_service_recv. next( ) => Action :: InspectService ( m) ,
212212 r = recv. recv( ) . fuse( ) => Action :: WorkerRpc ( r) ,
213213 e = ctrl_fut. fuse( ) => Action :: ControllerEvent ( e) ,
214- _reason = wait_cancel_fut. fuse( ) => Action :: WaitVmCancelled ,
214+ reason = wait_cancel_fut. fuse( ) => Action :: WaitVmCancelled ( reason . unwrap ( ) ) ,
215215 } ;
216216
217217 // Restore controller events (unless the channel closed).
@@ -258,9 +258,11 @@ impl VmService {
258258 self . handle_controller_event ( event) ;
259259 }
260260 Action :: ControllerEvent ( None ) => { } // handled above
261- Action :: WaitVmCancelled => {
261+ Action :: WaitVmCancelled ( reason ) => {
262262 tracing:: debug!( "WaitVm client cancelled" ) ;
263- self . wait_vm_response . take ( ) ;
263+ if let Some ( ( _, response) ) = self . wait_vm_response . take ( ) {
264+ response. send ( Err ( grpc_error ( anyhow:: Error :: new ( reason) ) ) ) ;
265+ }
264266 }
265267 }
266268 } ;
0 commit comments