[Spice-devel] [PATCH spice 1/3] char_device: Properly update buffer status when leaving the write loop on stop

Yonit Halperin yhalperi at redhat.com
Mon Apr 1 09:18:40 PDT 2013


Ack series

On 03/29/2013 05:11 AM, Hans de Goede wrote:
> Before this patch the write-loop in spice_char_device_write_to_device would
> break on running becoming 0, after having written some data, without updating
> the buffer status, causing the same data to be written *again* when started.
>
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
>   server/char_device.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/server/char_device.c b/server/char_device.c
> index e07eda1..368c9bc 100644
> --- a/server/char_device.c
> +++ b/server/char_device.c
> @@ -438,7 +438,7 @@ static int spice_char_device_write_to_device(SpiceCharDeviceState *dev)
>       core->timer_cancel(dev->write_to_dev_timer);
>
>       sif = SPICE_CONTAINEROF(dev->sin->base.sif, SpiceCharDeviceInterface, base);
> -    while (1) {
> +    while (dev->running) {
>           uint32_t write_len;
>
>           if (!dev->cur_write_buf) {
> @@ -454,9 +454,6 @@ static int spice_char_device_write_to_device(SpiceCharDeviceState *dev)
>           write_len = dev->cur_write_buf->buf + dev->cur_write_buf->buf_used -
>                       dev->cur_write_buf_pos;
>           n = sif->write(dev->sin, dev->cur_write_buf_pos, write_len);
> -        if (!dev->running) {
> -            break;
> -        }
>           if (n <= 0) {
>               break;
>           }
>



More information about the Spice-devel mailing list