[PATCH spice-server v4 1/4] stream-device: Avoid device to get stuck if multiple messages are batched

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If messages are sent together by the agent the device is reading
only part of the data. This cause Qemu to not poll for new data and
stream_device_read_msg_from_dev won't be called again.
This can cause a stall. To avoid this continue handling data
after a full message was processed.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/stream-device.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/server/stream-device.c b/server/stream-device.c
index 4eaa959b..897fc665 100644
--- a/server/stream-device.c
+++ b/server/stream-device.c
@@ -123,6 +123,15 @@ stream_device_read_msg_from_dev(RedCharDevice *self, SpiceCharDeviceInstance *si
         dev->hdr_pos = 0;
     }
 
+    if (handled || dev->has_error) {
+        // Qemu put the device on blocking state if we don't read all data
+        // so schedule another read.
+        // We arrive here if we processed that entire message or we
+        // got an error, try to read another message or discard the
+        // wrong data
+        red_char_device_wakeup(self);
+    }
+
     return NULL;
 }
 
-- 
2.14.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]