[Spice-devel] [PATCH spice-server v2 1/2] test-stream-device: Better Qemu emulation for data reading
Frediano Ziglio
fziglio at redhat.com
Thu Jan 11 11:42:18 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
>
Yes, the change in stream-device.c handle the better emulation.
But apparently can be split (the path that leaded to this patch didn't make
this obvious).
Frediano
More information about the Spice-devel
mailing list