From 8641af3c6d11e3e6710cb946e9a93d0e9f639519 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 18 Nov 2004 20:50:44 +0000 Subject: * some iochannel fixes * introduce reference counting in ioline * fix memory leak in socket-client.c * fix double-free error in protocol-esound.c git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@293 fefdeb5f-60dc-0310-8127-8f9354f1896f --- polyp/pstream.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'polyp/pstream.c') diff --git a/polyp/pstream.c b/polyp/pstream.c index 11ca3963..c081c242 100644 --- a/polyp/pstream.c +++ b/polyp/pstream.c @@ -103,25 +103,22 @@ static void do_read(struct pa_pstream *p); static void do_something(struct pa_pstream *p) { assert(p); - if (p->dead) - return; - p->mainloop->defer_enable(p->defer_event, 0); pa_pstream_ref(p); - if (!p->dead && pa_iochannel_is_hungup(p->io)) { - p->dead = 1; - if (p->die_callback) - p->die_callback(p, p->die_callback_userdata); - } + if (!p->dead && pa_iochannel_is_readable(p->io)) + do_read(p); if (!p->dead && pa_iochannel_is_writable(p->io)) do_write(p); - if (!p->dead && pa_iochannel_is_readable(p->io)) - do_read(p); - + /* In case the line was hungup, make sure to rerun this function + as soon as possible, until all data has been read. */ + + if (!p->dead && pa_iochannel_is_hungup(p->io)) + p->mainloop->defer_enable(p->defer_event, 1); + pa_pstream_unref(p); } -- cgit