[pulseaudio-commits] src/pulsecore

David Henningsson diwic at kemper.freedesktop.org
Sun Jun 16 23:54:48 PDT 2013


 src/pulsecore/pstream.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit b2792d783745ec726a00c4805402a77870549156
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Mon Jun 17 08:52:07 2013 +0200

    pstream: Fixup hangs caused by recent iochannel patch
    
    Now that we don't *always* get a callback after having written
    something, make sure we can continue writing as long as it fully
    succeeds.
    
    Signed-off-by: David Henningsson <david.henningsson at canonical.com>

diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c
index 9463437..6cf4394 100644
--- a/src/pulsecore/pstream.c
+++ b/src/pulsecore/pstream.c
@@ -187,9 +187,12 @@ static void do_pstream_read_write(pa_pstream *p) {
     } else if (!p->dead && pa_iochannel_is_hungup(p->io))
         goto fail;
 
-    if (!p->dead && pa_iochannel_is_writable(p->io)) {
-        if (do_write(p) < 0)
+    while (!p->dead && pa_iochannel_is_writable(p->io)) {
+        int r = do_write(p);
+        if (r < 0)
             goto fail;
+        if (r == 0)
+            break;
     }
 
     pa_pstream_unref(p);
@@ -634,7 +637,7 @@ static int do_write(pa_pstream *p) {
             p->drain_callback(p, p->drain_callback_userdata);
     }
 
-    return 0;
+    return (size_t) r == l ? 1 : 0;
 
 fail:
 



More information about the pulseaudio-commits mailing list