[Spice-devel] [PATCH spice-server v2 1/2] test-stream-device: Better Qemu emulation for data reading

Christophe Fergeau cfergeau at redhat.com
Wed Jan 10 17:06:39 UTC 2018


On Thu, Dec 07, 2017 at 08:47:38AM +0000, Frediano Ziglio wrote:
> Qemu does not trigger a new data read if we don't read all data in
> the buffer.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/stream-device.c            |  9 ++++++++
>  server/tests/test-stream-device.c | 43 +++++++++++++++++++++++++++++++++++++--
>  2 files changed, 50 insertions(+), 2 deletions(-)
> 
> Changes since v1:
> - avoid an inifinite loop, test added.
> 
> 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);
> +    }
> +

This is supposed to be a commit changing test-stream-device.c, but there
is this hunk in server/stream-device.c, is it intentional that it's
there?

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180110/845e0c6d/attachment.sig>


More information about the Spice-devel mailing list