summary refs log tree commit diff
path: root/devices/src/virtio/wl.rs
diff options
context:
space:
mode:
authorZach Reizner <zachr@google.com>2018-04-26 13:44:11 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-04-27 12:22:37 -0700
commit71aedde5af253e435c351da42b40c1e9c16df8c0 (patch)
tree6b05db524ad67345353e335272869b5606d6df53 /devices/src/virtio/wl.rs
parentdafdbc01cbdd318180b6f28dbc6d05b60cf443b7 (diff)
downloadcrosvm-71aedde5af253e435c351da42b40c1e9c16df8c0.tar
crosvm-71aedde5af253e435c351da42b40c1e9c16df8c0.tar.gz
crosvm-71aedde5af253e435c351da42b40c1e9c16df8c0.tar.bz2
crosvm-71aedde5af253e435c351da42b40c1e9c16df8c0.tar.lz
crosvm-71aedde5af253e435c351da42b40c1e9c16df8c0.tar.xz
crosvm-71aedde5af253e435c351da42b40c1e9c16df8c0.tar.zst
crosvm-71aedde5af253e435c351da42b40c1e9c16df8c0.zip
wl: send HUP event when VFDs are hungup
It is essential that paste operations on the guest receive a hangup
letting them know that there is no more data to read. This change fixes
that behavior, which was broken by thew new PollContext based logic,
which separates out the readable and hungup code paths.

TEST=finished wayland pastes receive EOF
BUG=chromium:835112

Change-Id: I764124ab2eabb32d8cc25a3a4c0dfbe49b26e799
Reviewed-on: https://chromium-review.googlesource.com/1031292
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: David Reveman <reveman@chromium.org>
Reviewed-by: David Reveman <reveman@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'devices/src/virtio/wl.rs')
-rw-r--r--devices/src/virtio/wl.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/devices/src/virtio/wl.rs b/devices/src/virtio/wl.rs
index 32ef2f0..2c34e4e 100644
--- a/devices/src/virtio/wl.rs
+++ b/devices/src/virtio/wl.rs
@@ -838,9 +838,16 @@ impl WlState {
 
         for event in events.as_ref().iter_hungup() {
             if !event.readable() {
-                if let Err(e) = self.close(event.token()) {
+                let vfd_id = event.token();
+                if let Err(e) = self.close(vfd_id) {
                     warn!("failed to close vfd: {:?}", 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));
             }
         }
     }