Re: [spice-server PATCH] stream_device_partial_read: check once if whole hdr is read

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

 



> 
> The "read header" loop checks if the whole header is read twice:
> once in the while condition and once in the end of the loop body.
> 
> This patch removes the latter check and sets appropriate variables
> outside of the loop.
> 
> Signed-off-by: Uri Lublin <uril@xxxxxxxxxx>

This patch does not pass "make check".
The reason is that that code is executed multiple time for the
same message if the message is send using multiple send.

> ---
>  server/stream-device.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/server/stream-device.c b/server/stream-device.c
> index cbd34463f..9d6b0e6c0 100644
> --- a/server/stream-device.c
> +++ b/server/stream-device.c
> @@ -97,13 +97,12 @@ stream_device_partial_read(StreamDevice *dev,
> SpiceCharDeviceInstance *sin)
>              return false;
>          }
>          dev->hdr_pos += n;
> -        if (dev->hdr_pos >= sizeof(dev->hdr)) {
> -            dev->hdr.type = GUINT16_FROM_LE(dev->hdr.type);
> -            dev->hdr.size = GUINT32_FROM_LE(dev->hdr.size);
> -            dev->msg_pos = 0;
> -        }
>      }
>  
> +    dev->hdr.type = GUINT16_FROM_LE(dev->hdr.type);
> +    dev->hdr.size = GUINT32_FROM_LE(dev->hdr.size);
> +    dev->msg_pos = 0;
> +
>      switch ((StreamMsgType) dev->hdr.type) {
>      case STREAM_TYPE_FORMAT:
>          if (dev->hdr.size != sizeof(StreamMsgFormat)) {

Frediano
_______________________________________________
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]