diff --git a/devices/src/virtio/wl.rs b/devices/src/virtio/wl.rs index 6a81bf3ce5..956163ef0c 100644 --- a/devices/src/virtio/wl.rs +++ b/devices/src/virtio/wl.rs @@ -996,14 +996,11 @@ impl WlState { for event in events.as_ref().iter_hungup() { if !event.readable() { let vfd_id = event.token(); - if let Err(e) = self.close(vfd_id) { - warn!("failed to close vfd: {:?}", e) + if let Some(fd) = self.vfds.get(&vfd_id).and_then(|vfd| vfd.poll_fd()) { + if let Err(e) = self.poll_ctx.delete(fd) { + warn!("failed to remove hungup vfd from poll context: {:?}", e); + } } - // Once the vfd has been hungup and there is nothing left to read, it's time to send - // the HUP event over virtio. It's very important that this in_queue entry gets - // pushed /after/ we self.close the vfd_id because part of the close operation for a - // vfd is removing all pending in_queue entries related to the vfd, regardless of - // type. self.in_queue.push_back((vfd_id, WlRecv::Hup)); } }