protocol-esound/http/simple: Make sure callers can handle iochannel_write changes

With the new behaviour, you will not always get a callback after a
successful write. Make sure the callers can properly handle this.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2013-06-24 17:29:26 +02:00 committed by Tanu Kaskinen
parent 97da92d894
commit 8127f8f9c5
3 changed files with 23 additions and 12 deletions

View file

@ -235,7 +235,7 @@ static int do_write(connection *c) {
pa_memblockq_drop(c->output_memblockq, (size_t) r);
return 0;
return 1;
}
static void do_work(connection *c) {
@ -251,9 +251,13 @@ static void do_work(connection *c) {
if (!c->sink_input && pa_iochannel_is_hungup(c->io))
goto fail;
if (pa_iochannel_is_writable(c->io))
if (do_write(c) < 0)
while (pa_iochannel_is_writable(c->io)) {
int r = do_write(c);
if (r < 0)
goto fail;
if (r == 0)
break;
}
return;