[Spice-devel] [PATCH spice-gtk 2/6] Make sure spice_channel_iterate_write() always flushes *all* pending writes

Marc-André Lureau marcandre.lureau at gmail.com
Fri Dec 2 08:31:35 PST 2011


On Thu, Dec 1, 2011 at 4:48 PM, Hans de Goede <hdegoede at redhat.com> wrote:
> This patch changes 1 line, and fixes 2 bugs in this one line:
> 1) We keep the xmit_buffer around for reuse (re-filling) later, so checking
>   if we've a xmit_buffer to determine wether we should do a write is wrong,
>   instead we should check if the xmit_buffer has data in it.

It wasn't exactly wrong, since the size is correct, just a bit useless
perhaps (that's actually a change you made in 7ad43d9d7;)

> 2) If the write blocks, and we switch to another co-routine context, this
>   context may queue more writes, we check for this and throw away the
>   buffer we've been consuming when this happens, since the other context
>   will then have allocated a new buffer. But when this happens, we do *not*
>   consume the new buffer. So the queued data will not get transmitted
>   until the co-routine gets woken up by either another write, or by
>   receiving data to read.
>   This patch fixes this by changing the if to a while.

I think you are right :)

> Note that the code in question gets completely removed by the next patch in
> this series. As I noticed this while rewriting the code in question, still
> I decided to do a separate patch to fix this to:
> 1) Document this issue in the old code
> 2) Otherwise the move from the if to the while will happen in the new code
>   which may confuse readers of that patch.

ack

-- 
Marc-André Lureau


More information about the Spice-devel mailing list