]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/protocol-simple.c
protocol-esound/http/simple: Make sure callers can handle iochannel_write changes
[pulseaudio] / src / pulsecore / protocol-simple.c
index 0e7c6e0a7246c23d7d3dde8017eb872d6b40665c..14eb5663fb54afd09e71f0301f55d395617c6c7b 100644 (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;