[Spice-devel] [PATCH spice-server v3 1/3] stream-device: Avoid device to get stuck if multiple messages are batched
Frediano Ziglio
fziglio at redhat.com
Thu Jan 11 12:06:09 UTC 2018
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 at redhat.com>
---
server/stream-device.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/server/stream-device.c b/server/stream-device.c
index 4eaa959b6..897fc665f 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
More information about the Spice-devel
mailing list