pa_assert(c->write_data_index < c->write_data_length);
if ((r = pa_iochannel_write(c->io, (uint8_t*) c->write_data+c->write_data_index, c->write_data_length-c->write_data_index)) < 0) {
-
- if (r < 0 && (errno == EINTR || errno == EAGAIN))
- return 0;
-
pa_log("write(): %s", pa_cstrerror(errno));
return -1;
}
if (c->write_data_index >= c->write_data_length)
c->write_data_length = c->write_data_index = 0;
+ return 1;
+
} else if (c->state == ESD_STREAMING_DATA && c->source_output) {
pa_memchunk chunk;
ssize_t r;
}
pa_memblockq_drop(c->output_memblockq, (size_t) r);
+ return 1;
}
return 0;
* here, instead of simply waiting for read() to return 0. */
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;
pa_memblockq_drop(c->output_memblockq, (size_t) r);
- return 0;
+ return 1;
}
/* Called from main context */
if (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;
pa_memblockq_drop(c->output_memblockq, (size_t) r);
- return 0;
+ return 1;
}
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;